@lookiero/checkout 14.7.0 → 14.8.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 (68) hide show
  1. package/cypress/support/interceptViewPricingByCheckoutId.ts +3 -3
  2. package/dist/src/ExpoRoot.js +2 -3
  3. package/dist/src/infrastructure/delivery/bootstrap.mock.js +2 -2
  4. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.js +2 -3
  5. package/dist/src/infrastructure/projection/pricing/pricing.mock.d.ts +3 -9
  6. package/dist/src/infrastructure/projection/pricing/pricing.mock.js +11 -50
  7. package/dist/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.d.ts +2 -2
  8. package/dist/src/infrastructure/tracking/useTrackCheckout.d.ts +2 -2
  9. package/dist/src/infrastructure/tracking/useTrackCheckout.js +3 -3
  10. package/dist/src/infrastructure/ui/components/atoms/price/Price.d.ts +7 -2
  11. package/dist/src/infrastructure/ui/components/atoms/price/Price.js +7 -7
  12. package/dist/src/infrastructure/ui/views/checkout/Checkout.js +2 -2
  13. package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.js +1 -1
  14. package/dist/src/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.js +2 -1
  15. package/dist/src/infrastructure/ui/views/item/components/productVariantSlider/components/aspectRatioView/AspectRatioView.d.ts +15 -0
  16. package/dist/src/infrastructure/ui/views/item/components/productVariantSlider/components/aspectRatioView/AspectRatioView.js +16 -0
  17. package/dist/src/infrastructure/ui/views/return/components/price/Price.d.ts +7 -2
  18. package/dist/src/infrastructure/ui/views/return/components/price/Price.js +7 -7
  19. package/dist/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.js +1 -1
  20. package/dist/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.js +1 -1
  21. package/dist/src/infrastructure/ui/views/summary/Summary.js +3 -3
  22. package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.d.ts +2 -5
  23. package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.js +4 -4
  24. package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.d.ts +2 -5
  25. package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.js +16 -18
  26. package/dist/src/projection/customer/customer.d.ts +0 -1
  27. package/dist/src/projection/pricing/pricing.d.ts +6 -24
  28. package/dist/src/projection/pricing/pricing.js +1 -1
  29. package/dist/src/projection/pricing/viewPricingByCheckoutId.d.ts +2 -2
  30. package/dist/src/version.d.ts +2 -2
  31. package/dist/src/version.js +2 -2
  32. package/package.json +1 -1
  33. package/src/ExpoRoot.tsx +2 -3
  34. package/src/infrastructure/delivery/bootstrap.mock.ts +2 -2
  35. package/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.test.ts +3 -7
  36. package/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.ts +3 -8
  37. package/src/infrastructure/projection/pricing/pricing.mock.ts +13 -61
  38. package/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.test.ts +3 -3
  39. package/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.ts +2 -2
  40. package/src/infrastructure/tracking/useTrackCheckout.test.tsx +9 -9
  41. package/src/infrastructure/tracking/useTrackCheckout.ts +5 -5
  42. package/src/infrastructure/ui/components/atoms/price/Price.test.tsx +22 -4
  43. package/src/infrastructure/ui/components/atoms/price/Price.tsx +14 -9
  44. package/src/infrastructure/ui/hooks/useCheckoutFlow.test.tsx +2 -2
  45. package/src/infrastructure/ui/views/checkout/Checkout.test.tsx +4 -10
  46. package/src/infrastructure/ui/views/checkout/Checkout.tsx +2 -7
  47. package/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.tsx +1 -1
  48. package/src/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.tsx +1 -1
  49. package/src/infrastructure/ui/views/item/components/productVariantSlider/__snapshots__/ProductVariantSlider.test.tsx.snap +198 -192
  50. package/src/infrastructure/ui/views/item/components/productVariantSlider/components/aspectRatioView/AspectRatioView.tsx +46 -0
  51. package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +594 -576
  52. package/src/infrastructure/ui/views/return/components/price/Price.test.tsx +22 -4
  53. package/src/infrastructure/ui/views/return/components/price/Price.tsx +14 -9
  54. package/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.tsx +6 -1
  55. package/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.tsx +6 -1
  56. package/src/infrastructure/ui/views/summary/Summary.test.tsx +4 -10
  57. package/src/infrastructure/ui/views/summary/Summary.tsx +1 -5
  58. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.test.tsx +10 -24
  59. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx +5 -15
  60. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/__snapshots__/CollapsiblePricing.test.tsx.snap +2 -2
  61. package/src/infrastructure/ui/views/summary/components/pricing/Pricing.tsx +42 -38
  62. package/src/projection/customer/customer.ts +0 -1
  63. package/src/projection/pricing/pricing.ts +6 -26
  64. package/src/projection/pricing/viewPricingByCheckoutId.test.ts +4 -5
  65. package/src/projection/pricing/viewPricingByCheckoutId.ts +2 -2
  66. package/dist/src/infrastructure/projection/pricing/pricing.d.ts +0 -18
  67. package/dist/src/infrastructure/projection/pricing/pricing.js +0 -12
  68. package/src/infrastructure/projection/pricing/pricing.ts +0 -32
@@ -1,5 +1,5 @@
1
1
  import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
2
- import { PricingProjection } from "./pricing";
2
+ import { CheckoutPricingProjection } from "./pricing";
3
3
  declare const VIEW_PRICING_BY_CHECKOUT_ID = "view_pricing_by_checkout_id";
4
4
  interface ViewPricingByCheckoutIdPayload {
5
5
  readonly checkoutId: string;
@@ -10,7 +10,7 @@ interface ViewPricingByCheckoutIdFunction {
10
10
  (payload: ViewPricingByCheckoutIdPayload): ViewPricingByCheckoutId;
11
11
  }
12
12
  declare const viewPricingByCheckoutId: ViewPricingByCheckoutIdFunction;
13
- type ViewPricingByCheckoutIdResult = PricingProjection | null;
13
+ type ViewPricingByCheckoutIdResult = CheckoutPricingProjection | null;
14
14
  interface PricingByCheckoutIdViewArgs extends CancelableQueryViewArgs {
15
15
  readonly checkoutId: string;
16
16
  }
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "14.7.0";
2
- export declare const RELEASE = "checkout@14.7.0";
1
+ export declare const VERSION = "14.8.0";
2
+ export declare const RELEASE = "checkout@14.8.0";
@@ -1,2 +1,2 @@
1
- export const VERSION = "14.7.0";
2
- export const RELEASE = "checkout@14.7.0";
1
+ export const VERSION = "14.8.0";
2
+ export const RELEASE = "checkout@14.8.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "14.7.0",
3
+ "version": "14.8.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": "false",
package/src/ExpoRoot.tsx CHANGED
@@ -25,12 +25,11 @@ const theme = themeByTradename({ tradename });
25
25
  const locale: Locale = Locale.es_ES;
26
26
 
27
27
  const customer: Customer = {
28
- customerId: "ec091fb1-04f3-46da-8262-aab5c88e0b3a",
28
+ customerId: "0d26cc55-b59e-4cde-971d-e587673f691e",
29
29
  country: Country.ES,
30
30
  segment: Segment.WOMEN,
31
31
  email: "email@example.com",
32
32
  name: "Adèle Léonce Émilie",
33
- migrated: false,
34
33
  };
35
34
 
36
35
  const sentryConfig: SentryEnvironment = {
@@ -50,7 +49,7 @@ const apiUrl =
50
49
  : "http://localhost:3004/local-to-dev"
51
50
  : "/checkout/api";
52
51
  const authToken =
53
- "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEzNzIyNDE2LCJleHAiOjE3NzE4NzQ4OTgsImRpc3BsYXlOYW1lIjoibWFpbC5kZXYrdGRwLjUzYWI2MmI5LTQwYTYtNDkwOC1iMGM0LWM3ZDRiNDZhODU2N0Bsb29raWVyby5jb20iLCJjb3VudHJ5X2NvZGUiOiJFUyIsImFjY2Vzc1ZpYSI6ImVtYWlsIiwidHJhZGVuYW1lIjoiTE9PS0lFUk8iLCJ1dWlkIjoiZWMwOTFmYjEtMDRmMy00NmRhLTgyNjItYWFiNWM4OGUwYjNhIiwiaWF0IjoxNzcxODQ2MDk4fQ.UKFl9pA4d1t9uR2iGVMc6XuwPbfUI_XWEbovie-Z_RI";
52
+ "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEzNzI0MjA2LCJleHAiOjE3NzMyNTgxNDYsImRpc3BsYXlOYW1lIjoibWFpbC5kZXYrdGRwLmMwN2NiYTQ3LTc5MDUtNDE0Yi04Y2ViLTIzZDIxMTgyZDgzMEBsb29raWVyby5jb20iLCJjb3VudHJ5X2NvZGUiOiJFUyIsImFjY2Vzc1ZpYSI6ImVtYWlsIiwidHJhZGVuYW1lIjoiTE9PS0lFUk8iLCJ1dWlkIjoiMGQyNmNjNTUtYjU5ZS00Y2RlLTk3MWQtZTU4NzY3M2Y2OTFlIiwiaWF0IjoxNzczMjI5MzQ2fQ.qEd3wCB6qbMBCZnOWa3sa_aC-FDJe_f1AshhXYq1MIM";
54
53
  const getAuthToken = () => Promise.resolve(authToken);
55
54
 
56
55
  const useRedirect: () => Record<string, string> = () => ({
@@ -19,7 +19,7 @@ import { checkoutFeedback as checkoutFeedbackMock } from "../projection/checkout
19
19
  import { checkoutFeedbackDefinition as checkoutFeedbackDefinitionMock } from "../projection/checkoutFeedback/checkoutFeedbackDefinition.mock";
20
20
  import { feedback as feedbackMock } from "../projection/feedback/feedback.mock";
21
21
  import { paymentFlowPayload as paymentFlowPayloadMock } from "../projection/payment/paymentFlowPayload.mock";
22
- import { pricing as pricingMock } from "../projection/pricing/pricing.mock";
22
+ import { mockCheckoutPricingProjection } from "../projection/pricing/pricing.mock";
23
23
  import { returnQuestions as returnQuestionsMock } from "../projection/returnQuestion/returnQuestions.mock";
24
24
  import { baseBootstrap } from "./baseBootstrap";
25
25
  import { checkoutBookingDataSource } from "./mock/checkoutBookingDataSource";
@@ -71,7 +71,7 @@ const returnQuestionsByCheckoutItemIdView: ReturnQuestionsByCheckoutItemIdView =
71
71
  const checkoutBookingByIdView: CheckoutBookingByIdView = async () => checkoutBookingMock;
72
72
  const bookedProductsVariantsForCheckoutItemView: BookedProductsVariantsForCheckoutItemView = async () =>
73
73
  bookedProductsVariants;
74
- const pricingByCheckoutIdView: PricingByCheckoutIdView = async () => pricingMock();
74
+ const pricingByCheckoutIdView: PricingByCheckoutIdView = async () => mockCheckoutPricingProjection;
75
75
  const paymentFlowPayloadByCheckoutIdView: PaymentFlowPayloadByCheckoutIdView = async () => paymentFlowPayloadMock;
76
76
  const checkoutFeedbackDefinitionByCheckoutIdView: CheckoutFeedbackDefinitionByCheckoutIdView = async () =>
77
77
  checkoutFeedbackDefinitionMock;
@@ -1,8 +1,7 @@
1
1
  import { mock } from "jest-mock-extended";
2
2
  import { fetchHttpPost } from "@lookiero/sty-psp-http";
3
- import { PricingProjection } from "../../../projection/pricing/pricing";
4
3
  import { httpPricingByCheckoutIdView as sut } from "./httpPricingByCheckoutIdView";
5
- import { pricing } from "./pricing.mock";
4
+ import { mockCheckoutPricingProjection } from "./pricing.mock";
6
5
 
7
6
  const fetchMock = jest.fn();
8
7
  global.fetch = fetchMock;
@@ -12,13 +11,10 @@ const view = sut({ httpPost: fetchHttpPost({ apiUrl: () => apiUrl, getAuthToken,
12
11
  const signal = mock<AbortSignal>();
13
12
 
14
13
  const checkoutId = "29790d24-b139-4ab8-b618-d796d101e974";
15
- const pricingResponse: { result: PricingProjection } = {
16
- result: pricing(),
17
- };
18
14
  const pricingResponseOk: Response = {
19
15
  ok: true,
20
16
  status: 200,
21
- text: () => Promise.resolve(JSON.stringify(pricingResponse)),
17
+ text: () => Promise.resolve(JSON.stringify(mockCheckoutPricingProjection)),
22
18
  } as Response;
23
19
  const pricingResponseNotFound: Response = {
24
20
  ok: false,
@@ -34,7 +30,7 @@ describe("httpPricingByCheckoutIdView", () => {
34
30
 
35
31
  const returnedPricing = await view({ checkoutId, signal });
36
32
 
37
- expect(returnedPricing).toStrictEqual(pricingResponse.result);
33
+ expect(returnedPricing).toStrictEqual(mockCheckoutPricingProjection);
38
34
  });
39
35
 
40
36
  it("returns null for a 404 response", async () => {
@@ -3,7 +3,6 @@ import {
3
3
  PricingByCheckoutIdView,
4
4
  ViewPricingByCheckoutIdResult,
5
5
  } from "../../../projection/pricing/viewPricingByCheckoutId";
6
- import { PricingDto, toPricingProjection } from "./pricing";
7
6
 
8
7
  interface HttpPricingByCheckoutIdView extends PricingByCheckoutIdView {}
9
8
 
@@ -15,20 +14,16 @@ interface HttpPricingByCheckoutIdViewFunction {
15
14
  (args: HttpPricingByCheckoutIdViewFunctionArgs): HttpPricingByCheckoutIdView;
16
15
  }
17
16
 
18
- interface ViewPricingByCheckoutIdResponse {
19
- readonly result: PricingDto;
20
- }
21
-
22
17
  const httpPricingByCheckoutIdView: HttpPricingByCheckoutIdViewFunction =
23
18
  ({ httpPost }) =>
24
19
  async ({ checkoutId, signal }) =>
25
- await httpPost<ViewPricingByCheckoutIdResponse, ViewPricingByCheckoutIdResult>({
26
- endpoint: "/view-pricing-by-checkout-id",
20
+ await httpPost<ViewPricingByCheckoutIdResult>({
21
+ endpoint: "/view-checkout-pricing-by-checkout-id",
27
22
  body: { checkoutId },
28
23
  signal,
29
24
  result: {
30
25
  error: null,
31
- success: (response) => toPricingProjection(response.result),
26
+ success: (response) => response,
32
27
  },
33
28
  });
34
29
 
@@ -1,85 +1,37 @@
1
1
  import { Currency } from "@lookiero/sty-psp-locale";
2
2
  import {
3
3
  CheckoutPricingProjection,
4
- CheckoutPrincingContext,
5
- CheckoutPrincingType,
6
- PricingProjection,
4
+ CheckoutPricingContext,
5
+ CheckoutPricingType,
7
6
  } from "../../../projection/pricing/pricing";
8
7
 
9
- interface PricingFunctionArgs {
10
- readonly paidWithPromocode: boolean;
11
- }
12
-
13
- interface PricingFunction {
14
- (args?: PricingFunctionArgs): PricingProjection;
15
- }
16
-
17
- const pricing: PricingFunction = ({ paidWithPromocode } = { paidWithPromocode: false }) => ({
18
- orderTotal: {
19
- amount: 18301,
20
- currency: Currency.EUR,
21
- },
22
- pendingToPay: {
23
- amount: 16301,
24
- currency: Currency.EUR,
25
- },
26
- subtotal: {
27
- amount: 21801,
28
- currency: Currency.EUR,
29
- },
30
- discount: {
31
- amount: -2500,
32
- currency: Currency.EUR,
33
- },
34
- discountPercentage: 25,
35
- balanceDiscount: {
36
- amount: -2000,
37
- currency: Currency.EUR,
38
- },
39
- service: {
40
- reference: "LK-service",
41
- originalPrice: {
42
- amount: 10.0,
43
- currency: Currency.EUR,
44
- },
45
- discount: {
46
- amount: 0,
47
- currency: Currency.EUR,
48
- },
49
- finalPrice: {
50
- amount: -1000,
51
- currency: Currency.EUR,
52
- },
53
- prepaid: true,
54
- paidWithPromocode,
55
- },
56
- });
57
-
58
8
  const mockCheckoutPricingProjection: CheckoutPricingProjection = {
59
9
  currency: Currency.EUR,
60
- final: 12127,
61
- original: 21195,
10
+ finalPrice: 12127,
11
+ originalPrice: 21195,
62
12
  modifiers: [
63
13
  {
64
14
  amount: 7068,
65
15
  percentage: 35,
66
- type: CheckoutPrincingType.DISCOUNT,
67
- context: CheckoutPrincingContext.PROMOCODE,
16
+ type: CheckoutPricingType.DISCOUNT,
17
+ context: CheckoutPricingContext.PROMOCODE,
68
18
  translationKey: "summary.discount",
69
19
  },
70
20
  {
71
21
  amount: 1000,
72
- type: CheckoutPrincingType.DISCOUNT,
73
- context: CheckoutPrincingContext.BALANCE,
22
+ type: CheckoutPricingType.DISCOUNT,
23
+ context: CheckoutPricingContext.BALANCE,
74
24
  translationKey: "summary.credit",
75
25
  },
76
26
  {
77
27
  amount: 1000,
78
- type: CheckoutPrincingType.DISCOUNT,
79
- context: CheckoutPrincingContext.PS_FEE,
28
+ type: CheckoutPricingType.DISCOUNT,
29
+ context: CheckoutPricingContext.PS_FEE,
80
30
  translationKey: "summary.fee",
81
31
  },
82
32
  ],
83
33
  };
84
34
 
85
- export { pricing, mockCheckoutPricingProjection };
35
+ const pricing = (): CheckoutPricingProjection => mockCheckoutPricingProjection;
36
+
37
+ export { mockCheckoutPricingProjection, pricing };
@@ -5,11 +5,11 @@ import {
5
5
  VIEW_PRICING_BY_CHECKOUT_ID,
6
6
  } from "../../../../projection/pricing/viewPricingByCheckoutId";
7
7
  import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
8
- import { pricing } from "../pricing.mock";
8
+ import { mockCheckoutPricingProjection } from "../pricing.mock";
9
9
  import { useViewPricingByCheckoutId as sut } from "./useViewPricingByCheckoutId";
10
10
 
11
11
  const checkoutId = "6f720954-8039-4bed-9596-34fc5a02131b";
12
- const view = jest.fn().mockReturnValue(pricing);
12
+ const view = jest.fn().mockReturnValue(mockCheckoutPricingProjection);
13
13
  const { Component: Messaging } = bootstrap({ id: MESSAGING_CONTEXT_ID })
14
14
  .query(VIEW_PRICING_BY_CHECKOUT_ID, viewPricingByCheckoutIdHandler, {
15
15
  view,
@@ -25,7 +25,7 @@ describe("useViewPricingByCheckoutId integration hook", () => {
25
25
  await waitFor(() => {
26
26
  const [projection, status] = result.current;
27
27
 
28
- expect(projection).toStrictEqual(pricing);
28
+ expect(projection).toStrictEqual(mockCheckoutPricingProjection);
29
29
  expect(status).toBe(QueryStatus.SUCCESS);
30
30
  });
31
31
  });
@@ -4,7 +4,7 @@ import { isCheckoutItemKept } from "../../../../domain/checkoutItem/model/checko
4
4
  import { isCheckoutItemReplaced } from "../../../../domain/checkoutItem/model/checkoutItemReplaced";
5
5
  import { isCheckoutItemReset } from "../../../../domain/checkoutItem/model/checkoutItemReset";
6
6
  import { isCheckoutItemReturned } from "../../../../domain/checkoutItem/model/checkoutItemReturned";
7
- import { PricingProjection } from "../../../../projection/pricing/pricing";
7
+ import { CheckoutPricingProjection } from "../../../../projection/pricing/pricing";
8
8
  import { viewPricingByCheckoutId } from "../../../../projection/pricing/viewPricingByCheckoutId";
9
9
  import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
10
10
 
@@ -28,7 +28,7 @@ interface UseViewPricingByCheckoutIdFunctionArgs {
28
28
  }
29
29
 
30
30
  interface UseViewPricingByCheckoutIdFunction {
31
- (args: UseViewPricingByCheckoutIdFunctionArgs): UseQueryFunctionResult<PricingProjection>;
31
+ (args: UseViewPricingByCheckoutIdFunctionArgs): UseQueryFunctionResult<CheckoutPricingProjection>;
32
32
  }
33
33
 
34
34
  const useViewPricingByCheckoutId: UseViewPricingByCheckoutIdFunction = ({
@@ -5,7 +5,7 @@ import { Tradename } from "@lookiero/sty-sp-tradename";
5
5
  import { CheckoutStatus } from "../../domain/checkout/model/checkout";
6
6
  import { CheckoutItemStatus } from "../../domain/checkoutItem/model/checkoutItem";
7
7
  import { CheckoutProjection } from "../../projection/checkout/checkout";
8
- import { PricingProjection } from "../../projection/pricing/pricing";
8
+ import { CheckoutPricingProjection } from "../../projection/pricing/pricing";
9
9
  import { checkout as checkoutMock } from "../projection/checkout/checkout.mock";
10
10
  import { CheckoutTrackingEvent, TrackingEventName, TrackingEventCategory } from "./tracking";
11
11
  import { useTrackCheckout as sut } from "./useTrackCheckout";
@@ -31,12 +31,12 @@ const checkout: CheckoutProjection = checkoutMock({
31
31
  })),
32
32
  ],
33
33
  });
34
- const pricing: PricingProjection = {
35
- pendingToPay: {
36
- amount: 16691,
37
- currency: Currency.EUR,
38
- },
39
- } as PricingProjection;
34
+ const pricing: CheckoutPricingProjection = {
35
+ currency: Currency.EUR,
36
+ finalPrice: 16691,
37
+ originalPrice: 21195,
38
+ modifiers: [],
39
+ };
40
40
 
41
41
  const event: CheckoutTrackingEvent = {
42
42
  event: TrackingEventName.CHECKOUT,
@@ -52,8 +52,8 @@ const event: CheckoutTrackingEvent = {
52
52
  checkout: {
53
53
  actionField: {
54
54
  items: checkoutItemsKept + checkoutItemsReplaced,
55
- currencyCode: pricing.pendingToPay.currency,
56
- value: pricing.pendingToPay.amount / 100,
55
+ currencyCode: pricing.currency,
56
+ value: pricing.finalPrice / 100,
57
57
  },
58
58
  },
59
59
  },
@@ -5,7 +5,7 @@ import { Segment } from "@lookiero/sty-psp-segment";
5
5
  import { Tradename } from "@lookiero/sty-sp-tradename";
6
6
  import { CheckoutItemStatus } from "../../domain/checkoutItem/model/checkoutItem";
7
7
  import { CheckoutProjection } from "../../projection/checkout/checkout";
8
- import { PricingProjection } from "../../projection/pricing/pricing";
8
+ import { CheckoutPricingProjection } from "../../projection/pricing/pricing";
9
9
  import { PROJECT, TrackingPage } from "./tracking";
10
10
  import { CheckoutTrackingEvent, TrackingEventName, TrackingEventCategory } from "./tracking";
11
11
 
@@ -15,7 +15,7 @@ interface TrackCheckoutFunction {
15
15
 
16
16
  interface UseTrackCheckoutFunctionArgs {
17
17
  readonly checkout: CheckoutProjection | undefined;
18
- readonly pricing: PricingProjection | undefined;
18
+ readonly pricing: CheckoutPricingProjection | undefined;
19
19
  readonly userId: string;
20
20
  readonly country: Country;
21
21
  readonly segment: Segment;
@@ -51,18 +51,18 @@ const useTrackCheckout: UseTrackCheckoutFunction = ({ checkout, pricing, segment
51
51
  checkout: {
52
52
  actionField: {
53
53
  items: checkoutItemsKept.length || 0,
54
- currencyCode: pricing?.pendingToPay.currency as Currency,
54
+ currencyCode: pricing?.currency as Currency,
55
55
  // subscription,
56
56
  // coupon,
57
57
  // orderId: orderNumber,
58
- value: (pricing?.pendingToPay.amount as number) / 100,
58
+ value: (pricing?.finalPrice as number) / 100,
59
59
  },
60
60
  },
61
61
  },
62
62
  };
63
63
 
64
64
  return checkoutTrackingEvent;
65
- }, [checkout, country, pricing?.pendingToPay.amount, pricing?.pendingToPay.currency, segment, userId, tradename]);
65
+ }, [checkout, country, pricing?.finalPrice, pricing?.currency, segment, userId, tradename]);
66
66
 
67
67
  return trackCheckout;
68
68
  };
@@ -20,19 +20,31 @@ const discountedPrice: PriceProjection = {
20
20
 
21
21
  describe("Price atom", () => {
22
22
  it("matches the snapshot for a non-discounted price", async () => {
23
- const { toJSON } = render(<Price price={price} />);
23
+ const { toJSON } = render(<Price amount={price.amount} currency={price.currency} />);
24
24
 
25
25
  expect(toJSON()).toMatchSnapshot("non-discounted price");
26
26
  });
27
27
 
28
28
  it("matches the snapshot for a discounted price", async () => {
29
- const { toJSON } = render(<Price price={discountedPrice} />);
29
+ const { toJSON } = render(
30
+ <Price
31
+ amount={discountedPrice.amount}
32
+ currency={discountedPrice.currency}
33
+ discountedPrice={discountedPrice.discountedPrice}
34
+ />,
35
+ );
30
36
 
31
37
  expect(toJSON()).toMatchSnapshot("discounted price");
32
38
  });
33
39
 
34
40
  it("renders the non-discounted price text", async () => {
35
- const { findByTestId } = render(<Price price={discountedPrice} />);
41
+ const { findByTestId } = render(
42
+ <Price
43
+ amount={discountedPrice.amount}
44
+ currency={discountedPrice.currency}
45
+ discountedPrice={discountedPrice.discountedPrice}
46
+ />,
47
+ );
36
48
 
37
49
  const priceText = await findByTestId("price-text");
38
50
 
@@ -40,7 +52,13 @@ describe("Price atom", () => {
40
52
  });
41
53
 
42
54
  it("renders the discounted price text", async () => {
43
- const { findByTestId } = render(<Price price={discountedPrice} />);
55
+ const { findByTestId } = render(
56
+ <Price
57
+ amount={discountedPrice.amount}
58
+ currency={discountedPrice.currency}
59
+ discountedPrice={discountedPrice.discountedPrice}
60
+ />,
61
+ );
44
62
 
45
63
  const discountedPriceText = await findByTestId("discounted-price-text");
46
64
 
@@ -1,8 +1,8 @@
1
1
  import React, { FC, useMemo } from "react";
2
2
  import { View } from "react-native";
3
3
  import { useI18nNumber } from "@lookiero/i18n-react";
4
+ import { Currency } from "@lookiero/sty-psp-locale";
4
5
  import { Text, TextLevel, TextVariant } from "@lookiero/sty-psp-ui";
5
- import { PriceProjection } from "../../../../../projection/price/price";
6
6
  import { DOMAIN } from "../../../i18n/i18n";
7
7
  import { style as priceStyle } from "./Price.style";
8
8
 
@@ -21,23 +21,28 @@ const PRICE_VARIANT: Partial<Record<PriceVariant, PriceVariantProps>> = {
21
21
  };
22
22
 
23
23
  interface PriceProps {
24
- readonly price: PriceProjection;
24
+ readonly amount: number;
25
+ readonly currency: Currency;
26
+ readonly discountedPrice?: {
27
+ readonly amount: number;
28
+ readonly percentage: number;
29
+ };
25
30
  readonly variant?: PriceVariant;
26
31
  readonly withPercentage?: boolean;
27
32
  }
28
- const Price: FC<PriceProps> = ({ price, variant = "default", withPercentage = false }) => {
29
- const isDiscounted = price.discountedPrice && price.discountedPrice.percentage > 0;
33
+ const Price: FC<PriceProps> = ({ amount, currency, discountedPrice, variant = "default", withPercentage = false }) => {
34
+ const isDiscounted = discountedPrice && discountedPrice.percentage > 0;
30
35
  const productPrice = useI18nNumber({
31
36
  domain: DOMAIN,
32
- value: price.amount / 100,
37
+ value: amount / 100,
33
38
  style: "currency",
34
- currency: price.currency,
39
+ currency,
35
40
  });
36
41
  const productDiscountedPrice = useI18nNumber({
37
42
  domain: DOMAIN,
38
- value: (price.discountedPrice?.amount || 0) / 100,
43
+ value: (discountedPrice?.amount || 0) / 100,
39
44
  style: "currency",
40
- currency: price.currency,
45
+ currency,
41
46
  });
42
47
 
43
48
  const priceValue = isDiscounted ? productDiscountedPrice : productPrice;
@@ -56,7 +61,7 @@ const Price: FC<PriceProps> = ({ price, variant = "default", withPercentage = fa
56
61
  </Text>
57
62
  {withPercentage ? (
58
63
  <Text {...PRICE_VARIANT[variant]} style={style.discountedPercentage} testID="discounted-percentage-text">
59
- {`-${price.discountedPrice.percentage}%`}
64
+ {`-${discountedPrice.percentage}%`}
60
65
  </Text>
61
66
  ) : null}
62
67
  </View>
@@ -14,7 +14,7 @@ import { checkout } from "../../projection/checkout/checkout.mock";
14
14
  import { useViewIsSizeChangeEnabledByCheckoutId } from "../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
15
15
  import { paymentFlowPayload as mockPaymentFlowPayload } from "../../projection/payment/paymentFlowPayload.mock";
16
16
  import { useViewPaymentFlowPayloadByCheckoutId } from "../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId";
17
- import { pricing } from "../../projection/pricing/pricing.mock";
17
+ import { mockCheckoutPricingProjection } from "../../projection/pricing/pricing.mock";
18
18
  import { useViewPricingByCheckoutId } from "../../projection/pricing/react/useViewPricingByCheckoutId";
19
19
  import { I18nMessages } from "../i18n/i18n";
20
20
  import { Routes } from "../routing/routes";
@@ -37,7 +37,7 @@ const order: OrderProjection = {
37
37
  isFirstOrder: false,
38
38
  coupon: null,
39
39
  };
40
- const mockPricing = pricing();
40
+ const mockPricing = mockCheckoutPricingProjection;
41
41
  const subscription: SubscriptionProjection = "o";
42
42
  const customerId = "a8fff6d7-708c-41a7-b42a-58c5706d33df";
43
43
  const basePath = "/checkout";
@@ -12,7 +12,7 @@ import { OrderProjection } from "../../../../projection/order/order";
12
12
  import { SubscriptionProjection } from "../../../../projection/subscription/subscription";
13
13
  import { checkout } from "../../../projection/checkout/checkout.mock";
14
14
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
15
- import { pricing } from "../../../projection/pricing/pricing.mock";
15
+ import { mockCheckoutPricingProjection } from "../../../projection/pricing/pricing.mock";
16
16
  import { useViewPricingByCheckoutId } from "../../../projection/pricing/react/useViewPricingByCheckoutId";
17
17
  import { I18nMessages } from "../../i18n/i18n";
18
18
  import { Routes } from "../../routing/routes";
@@ -28,7 +28,6 @@ const mockCustomer: Customer = {
28
28
  customerId,
29
29
  country,
30
30
  segment,
31
- migrated: false,
32
31
  } as Customer;
33
32
  const mockCheckout = checkout({
34
33
  items: [
@@ -91,7 +90,7 @@ beforeEach(() => {
91
90
  describe("Checkout view", () => {
92
91
  it("renders correctly", async () => {
93
92
  (useViewFirstAvailableCheckoutByCustomerId as jest.Mock).mockReturnValue([mockCheckout, QueryStatus.SUCCESS]);
94
- (useViewPricingByCheckoutId as jest.Mock).mockReturnValue([pricing(), QueryStatus.SUCCESS]);
93
+ (useViewPricingByCheckoutId as jest.Mock).mockReturnValue([mockCheckoutPricingProjection, QueryStatus.SUCCESS]);
95
94
  const { findByText, getAllByTestId, getByText, getByTestId } = render(
96
95
  <Checkout
97
96
  getAuthToken={getAuthToken}
@@ -110,16 +109,11 @@ describe("Checkout view", () => {
110
109
  expect(getAllByTestId("checkout-items-kept")).toHaveLength(4);
111
110
 
112
111
  expect(getByText(`${I18nMessages.SUMMARY_SUBTOTAL} ${I18nMessages.SUMMARY_TOTAL_ITEMS_KEPT}`)).toBeTruthy();
113
- expect(getByText("€218.01")).toBeTruthy();
112
+ expect(getByText("€211.95")).toBeTruthy();
114
113
 
115
114
  expect(getByText(I18nMessages.SUMMARY_DISCOUNT)).toBeTruthy();
116
- expect(getByText("-€25.00")).toBeTruthy();
117
-
118
115
  expect(getByText(I18nMessages.SUMMARY_CREDIT)).toBeTruthy();
119
- expect(getByText("-€20.00")).toBeTruthy();
120
-
121
116
  expect(getByText(I18nMessages.SUMMARY_FEE)).toBeTruthy();
122
- expect(getByText("-€10.00")).toBeTruthy();
123
117
 
124
118
  expect(getByTestId(paymentFlowTestId)).toBeTruthy();
125
119
 
@@ -144,7 +138,7 @@ describe("Checkout view", () => {
144
138
  ],
145
139
  });
146
140
  (useViewFirstAvailableCheckoutByCustomerId as jest.Mock).mockReturnValue([mockCheckout, QueryStatus.SUCCESS]);
147
- (useViewPricingByCheckoutId as jest.Mock).mockReturnValue([pricing(), QueryStatus.SUCCESS]);
141
+ (useViewPricingByCheckoutId as jest.Mock).mockReturnValue([mockCheckoutPricingProjection, QueryStatus.SUCCESS]);
148
142
 
149
143
  const { findByText, queryByText } = render(
150
144
  <Checkout
@@ -35,7 +35,7 @@ interface CheckoutProps {
35
35
 
36
36
  const Checkout: FC<CheckoutProps> = ({ layout: Layout, getAuthToken, useRedirect, onCheckoutFlowSuccess }) => {
37
37
  const {
38
- customer: { customerId, country, segment, migrated },
38
+ customer: { customerId, country, segment },
39
39
  basePath,
40
40
  tradename,
41
41
  } = useStaticInfo();
@@ -185,12 +185,7 @@ const Checkout: FC<CheckoutProps> = ({ layout: Layout, getAuthToken, useRedirect
185
185
  <Box size={{ L: "1/3" }} style={[style.resume, isDektopScreen && style.desktopResume]}>
186
186
  {pricing ? (
187
187
  <View style={[style.princingWrapper, !isDektopScreen && style.princingWrapperSmall]}>
188
- <Pricing
189
- migrated={migrated}
190
- pricing={pricing}
191
- totalCheckoutItemsKept={checkoutItemsKept?.length || 0}
192
- tradename={tradename}
193
- />
188
+ <Pricing pricing={pricing} totalCheckoutItemsKept={checkoutItemsKept?.length || 0} />
194
189
 
195
190
  {isDektopScreen && <PaymentButton />}
196
191
  </View>
@@ -43,7 +43,7 @@ const ProductVariantDescription: FC<ProductVariantDescriptionProps> = ({
43
43
  {name}
44
44
  </Text>
45
45
  </View>
46
- <Price price={price} withPercentage />
46
+ <Price amount={price.amount} currency={price.currency} discountedPrice={price.discountedPrice} withPercentage />
47
47
  </View>
48
48
  <Text level={1} variant="detail">
49
49
  {`${sizeText} ${sizeProjection.unique ? uniqueText : size({ size: sizeProjection, country })}`}
@@ -1,7 +1,6 @@
1
1
  import React, { FC, useCallback, useMemo, useState } from "react";
2
2
  import { LayoutChangeEvent, View } from "react-native";
3
3
  import {
4
- AspectRatioView,
5
4
  Bullets,
6
5
  Carousel,
7
6
  LazyImage,
@@ -12,6 +11,7 @@ import {
12
11
  import { MediaPerspective, MediaProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
13
12
  import { useMediaImage } from "../../../../hooks/useMediaImage";
14
13
  import { style as productVariantSliderStyle } from "./ProductVariantSlider.style";
14
+ import { AspectRatioView } from "./components/aspectRatioView/AspectRatioView";
15
15
 
16
16
  interface ProductVariantSlider {
17
17
  readonly producVariantMedia: MediaProjection[];