@lookiero/checkout 10.0.0-beta.4 → 10.0.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 (83) hide show
  1. package/dist/fake-dependencies/@lookiero/payments-front/index.d.ts +6 -8
  2. package/dist/fake-dependencies/@lookiero/payments-front/index.js +4 -7
  3. package/dist/index.d.ts +5 -4
  4. package/dist/index.js +2 -1
  5. package/dist/src/ExpoRoot.js +13 -17
  6. package/dist/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.d.ts +1 -1
  7. package/dist/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.js +0 -2
  8. package/dist/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.d.ts +1 -1
  9. package/dist/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.js +1 -2
  10. package/dist/src/infrastructure/tracking/tracking.d.ts +2 -2
  11. package/dist/src/infrastructure/tracking/useTrackCheckout.d.ts +17 -10
  12. package/dist/src/infrastructure/tracking/useTrackCheckout.js +12 -27
  13. package/dist/src/infrastructure/ui/Root.d.ts +9 -7
  14. package/dist/src/infrastructure/ui/Root.js +3 -2
  15. package/dist/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.d.ts +2 -3
  16. package/dist/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.js +26 -17
  17. package/dist/src/infrastructure/ui/hooks/useStaticInfo.d.ts +3 -0
  18. package/dist/src/infrastructure/ui/hooks/useStaticInfo.js +7 -2
  19. package/dist/src/infrastructure/ui/i18n/i18n.d.ts +0 -1
  20. package/dist/src/infrastructure/ui/i18n/i18n.js +0 -1
  21. package/dist/src/infrastructure/ui/routing/CheckoutMiddleware.js +12 -1
  22. package/dist/src/infrastructure/ui/routing/Routing.d.ts +7 -5
  23. package/dist/src/infrastructure/ui/routing/Routing.js +11 -3
  24. package/dist/src/infrastructure/ui/routing/routes.d.ts +1 -0
  25. package/dist/src/infrastructure/ui/routing/routes.js +1 -0
  26. package/dist/src/infrastructure/ui/views/App.js +6 -5
  27. package/dist/src/infrastructure/ui/views/checkout/Checkout.d.ts +2 -7
  28. package/dist/src/infrastructure/ui/views/checkout/Checkout.js +9 -20
  29. package/dist/src/infrastructure/ui/views/checkout/Checkout.style.d.ts +0 -3
  30. package/dist/src/infrastructure/ui/views/checkout/Checkout.style.js +0 -3
  31. package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +1 -3
  32. package/dist/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js +7 -7
  33. package/dist/src/infrastructure/ui/views/summary/Summary.js +1 -2
  34. package/dist/src/projection/customer/customer.d.ts +0 -2
  35. package/dist/src/projection/order/order.d.ts +1 -1
  36. package/dist/src/projection/subscription/subscription.d.ts +1 -1
  37. package/dist/src/version.d.ts +1 -1
  38. package/dist/src/version.js +1 -1
  39. package/fake-dependencies/@lookiero/payments-front/index.tsx +9 -32
  40. package/index.ts +5 -11
  41. package/package.json +4 -3
  42. package/src/ExpoRoot.tsx +37 -42
  43. package/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.ts +1 -4
  44. package/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.ts +2 -3
  45. package/src/infrastructure/tracking/tracking.ts +2 -2
  46. package/src/infrastructure/tracking/useTrackCheckout.ts +56 -66
  47. package/src/infrastructure/ui/Root.tsx +14 -10
  48. package/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.test.tsx +6 -0
  49. package/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.tsx +0 -1
  50. package/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.ts +60 -18
  51. package/src/infrastructure/ui/hooks/useStaticInfo.test.tsx +6 -1
  52. package/src/infrastructure/ui/hooks/useStaticInfo.tsx +13 -2
  53. package/src/infrastructure/ui/hooks/useSubmitCheckout.test.ts +297 -0
  54. package/src/infrastructure/ui/hooks/useSubmitCheckout.ts +169 -0
  55. package/src/infrastructure/ui/i18n/i18n.ts +0 -1
  56. package/src/infrastructure/ui/routing/CheckoutMiddleware.test.tsx +9 -1
  57. package/src/infrastructure/ui/routing/CheckoutMiddleware.tsx +15 -1
  58. package/src/infrastructure/ui/routing/Routing.tsx +29 -15
  59. package/src/infrastructure/ui/routing/routes.ts +1 -0
  60. package/src/infrastructure/ui/views/App.tsx +13 -5
  61. package/src/infrastructure/ui/views/checkout/Checkout.style.ts +0 -3
  62. package/src/infrastructure/ui/views/checkout/Checkout.test.tsx +43 -51
  63. package/src/infrastructure/ui/views/checkout/Checkout.tsx +13 -51
  64. package/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.test.tsx +134 -0
  65. package/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.tsx +124 -0
  66. package/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.tsx +8 -8
  67. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.test.tsx +6 -0
  68. package/src/infrastructure/ui/views/summary/Summary.tsx +1 -1
  69. package/src/infrastructure/ui/views/summaryTabs/SummaryTabs.test.tsx +4 -1
  70. package/src/projection/customer/customer.ts +0 -2
  71. package/src/projection/order/order.ts +1 -1
  72. package/src/projection/subscription/subscription.ts +1 -1
  73. package/dist/public/public/assets/adaptive-icon.png +0 -0
  74. package/dist/public/public/assets/favicon.png +0 -0
  75. package/dist/public/public/assets/icon.png +0 -0
  76. package/dist/public/public/assets/splash.png +0 -0
  77. package/dist/public/public/images/not-found.png +0 -0
  78. package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.d.ts +0 -26
  79. package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.js +0 -127
  80. package/dist/src/infrastructure/ui/routing/useBasePath.d.ts +0 -8
  81. package/dist/src/infrastructure/ui/routing/useBasePath.js +0 -9
  82. package/src/infrastructure/ui/hooks/useCheckoutFlow.test.tsx +0 -302
  83. package/src/infrastructure/ui/hooks/useCheckoutFlow.tsx +0 -203
@@ -5,6 +5,7 @@ export declare enum Routes {
5
5
  SUMMARY = "summary",
6
6
  SUMMARY_TABS = "tabs/:tab",
7
7
  CHECKOUT = "checkout",
8
+ CHECKOUT_PAYMENT = "payment",
8
9
  FEEDBACK = "feedback",
9
10
  RETURN = "return/:id"
10
11
  }
@@ -6,6 +6,7 @@ export var Routes;
6
6
  Routes["SUMMARY"] = "summary";
7
7
  Routes["SUMMARY_TABS"] = "tabs/:tab";
8
8
  Routes["CHECKOUT"] = "checkout";
9
+ Routes["CHECKOUT_PAYMENT"] = "payment";
9
10
  Routes["FEEDBACK"] = "feedback";
10
11
  Routes["RETURN"] = "return/:id";
11
12
  })(Routes || (Routes = {}));
@@ -1,15 +1,16 @@
1
- import { PortalHost } from "@gorhom/portal";
1
+ import { PortalProvider } from "@gorhom/portal";
2
2
  import React from "react";
3
3
  import { StatusBar } from "react-native";
4
4
  import { SafeAreaProvider } from "react-native-safe-area-context";
5
+ import { PortalProvider as AuroraPortalProvider } from "@lookiero/aurora";
5
6
  import { Notifications } from "@lookiero/sty-psp-notifications";
6
7
  import { theme } from "@lookiero/sty-psp-ui";
7
8
  import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
8
9
  import { DOMAIN } from "../i18n/i18n";
9
10
  const { colorBgBase } = theme();
10
11
  const App = ({ children }) => (React.createElement(SafeAreaProvider, null,
11
- React.createElement(StatusBar, { backgroundColor: colorBgBase, barStyle: "dark-content", translucent: true }),
12
- React.createElement(Notifications, { contextId: MESSAGING_CONTEXT_ID, domain: DOMAIN, portalHostName: "Checkout" }),
13
- React.createElement(PortalHost, { name: "Checkout" }),
14
- children));
12
+ React.createElement(PortalProvider, { rootHostName: "Checkout" },
13
+ React.createElement(StatusBar, { backgroundColor: colorBgBase, barStyle: "dark-content", translucent: true }),
14
+ React.createElement(Notifications, { contextId: MESSAGING_CONTEXT_ID, domain: DOMAIN, portalHostName: "Checkout" }),
15
+ React.createElement(AuroraPortalProvider, null, children))));
15
16
  export { App };
@@ -1,13 +1,8 @@
1
- import { FC } from "react";
1
+ import { FC, ReactNode } from "react";
2
2
  import { Layout as UiLayout } from "@lookiero/sty-psp-ui";
3
- import { OrderProjection } from "../../../../projection/order/order";
4
- import { SubscriptionProjection } from "../../../../projection/subscription/subscription";
5
3
  interface CheckoutProps {
4
+ readonly children?: ReactNode;
6
5
  readonly layout: UiLayout;
7
- readonly order: OrderProjection;
8
- readonly subscription: SubscriptionProjection;
9
- readonly getAuthToken: () => Promise<string>;
10
- readonly onCheckoutFlowSuccess: () => void;
11
6
  readonly useRedirect: () => Record<string, string>;
12
7
  }
13
8
  declare const Checkout: FC<CheckoutProps>;
@@ -4,7 +4,6 @@ import { useNavigate } from "react-router-native";
4
4
  import { Box, Button, Layout as AuroraLayout, Spinner, Text, useDevice } from "@lookiero/aurora";
5
5
  import { useI18nMessage } from "@lookiero/i18n-react";
6
6
  import { QueryStatus } from "@lookiero/messaging-react";
7
- import { Country } from "@lookiero/sty-psp-locale";
8
7
  import { Sticky } from "@lookiero/sty-psp-ui";
9
8
  import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
10
9
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
@@ -15,7 +14,6 @@ import { useTrackPressBack } from "../../../tracking/useTrackPressBack";
15
14
  import { useTrackPressContinue } from "../../../tracking/useTrackPressContinue";
16
15
  import { Body } from "../../components/layouts/body/Body";
17
16
  import { CheckoutHeader } from "../../components/templates/header/checkoutHeader/CheckoutHeader";
18
- import { useCheckoutFlow } from "../../hooks/useCheckoutFlow";
19
17
  import { useStaticInfo } from "../../hooks/useStaticInfo";
20
18
  import { DOMAIN, I18nMessages } from "../../i18n/i18n";
21
19
  import { Routes } from "../../routing/routes";
@@ -24,7 +22,7 @@ import { Pricing } from "../summary/components/pricing/Pricing";
24
22
  import { style } from "./Checkout.style";
25
23
  import { DeliveryBanner } from "./components/deliveryBanner/DeliveryBanner";
26
24
  import { PaymentInstrument } from "./components/paymentInstrument/PaymentInstrument";
27
- const Checkout = ({ layout: Layout, order, subscription, getAuthToken, useRedirect, onCheckoutFlowSuccess, }) => {
25
+ const Checkout = ({ children, layout: Layout, useRedirect }) => {
28
26
  const { customer: { customerId, country, segment }, basePath, } = useStaticInfo();
29
27
  const titleText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.CHECKOUT_TITLE });
30
28
  const submitButtonText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.CHECKOUT_PAY_BUTTON });
@@ -33,13 +31,6 @@ const Checkout = ({ layout: Layout, order, subscription, getAuthToken, useRedire
33
31
  const handleOnPricingLayout = useCallback(({ height }) => setPricingHeight(height), []);
34
32
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
35
33
  const [pricing, pricingStatus] = useViewPricingByCheckoutId({ checkoutId: checkout?.id });
36
- const [checkoutFlow, checkoutFlowStatus, paymentFlowComponent] = useCheckoutFlow({
37
- checkout,
38
- order,
39
- subscription,
40
- getAuthToken,
41
- onSuccess: onCheckoutFlowSuccess,
42
- });
43
34
  useTrackPageView({
44
35
  page: TrackingPage.CHECKOUT,
45
36
  country,
@@ -53,10 +44,10 @@ const Checkout = ({ layout: Layout, order, subscription, getAuthToken, useRedire
53
44
  segment,
54
45
  checkoutId: checkout?.id,
55
46
  });
56
- const handleOnSubmit = useCallback(async () => {
47
+ const handleOnSubmit = useCallback(() => {
57
48
  trackPressContinue();
58
- await checkoutFlow();
59
- }, [checkoutFlow, trackPressContinue]);
49
+ navigate(`${basePath}/${Routes.CHECKOUT}/${Routes.CHECKOUT_PAYMENT}`, { replace: true });
50
+ }, [basePath, navigate, trackPressContinue]);
60
51
  const checkoutItemsKept = useMemo(() => checkout?.items.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
61
52
  const hasReplacedCheckoutItem = useMemo(() => checkout?.items.some((checkoutItem) => checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
62
53
  const trackPressBack = useTrackPressBack({
@@ -84,21 +75,19 @@ const Checkout = ({ layout: Layout, order, subscription, getAuthToken, useRedire
84
75
  React.createElement(AuroraLayout, { fullWidth: !screen.L, style: [screen.L && style.desktopLayoutSpacing, !screen.L && { paddingBottom: pricingHeight }] },
85
76
  React.createElement(Box, { size: { L: "2/3" }, style: screen.L && style.desktopListSpacing },
86
77
  React.createElement(View, { style: [style.contentWrapper, screen.L && style.desktopContentWrapper] },
87
- country === Country.NL && (React.createElement(View, { style: style.paymentSelectorNL },
88
- React.createElement(PaymentInstrument, { useRedirect: useRedirect }))),
89
78
  React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
90
79
  checkoutItemsKept?.map((checkoutItem) => (React.createElement(View, { key: checkoutItem.id, testID: "checkout-items-kept" },
91
80
  React.createElement(ProductVariant, { brand: checkoutItem.productVariant.brand, color: checkoutItem.productVariant.color, country: country, media: checkoutItem.productVariant.media, name: checkoutItem.productVariant.name, price: checkoutItem.price, status: checkoutItem.status, size: checkoutItem.status === CheckoutItemStatus.REPLACED && checkoutItem.replacedFor
92
81
  ? checkoutItem.replacedFor.size
93
82
  : checkoutItem.productVariant.size })))),
94
- country !== Country.NL && (React.createElement(View, { style: style.paymentSelector },
95
- React.createElement(PaymentInstrument, { useRedirect: useRedirect }))))),
83
+ React.createElement(View, { style: style.paymentSelector },
84
+ React.createElement(PaymentInstrument, { useRedirect: useRedirect })))),
96
85
  React.createElement(Box, { size: { L: "1/3" }, style: [style.resume, screen.L && style.desktopResume] }, pricing ? (React.createElement(View, { style: [style.princingWrapper, !screen.L && style.princingWrapperSmall] },
97
86
  React.createElement(Pricing, { pricing: pricing, totalCheckoutItemsKept: checkoutItemsKept?.length || 0 }),
98
- screen.L ? (React.createElement(Button, { busy: checkoutFlowStatus === "loading", testID: "confirm-checkout-button", onPress: handleOnSubmit }, submitButtonText)) : null)) : null))),
87
+ screen.L ? (React.createElement(Button, { testID: "confirm-checkout-button", onPress: handleOnSubmit }, submitButtonText)) : null)) : null))),
99
88
  pricing && !screen.L ? (React.createElement(Sticky, { style: style.sticky, onLayout: Platform.OS !== "web" ? handleOnPricingLayout : undefined },
100
89
  React.createElement(Body, null,
101
- React.createElement(Button, { busy: checkoutFlowStatus === "loading", testID: "confirm-checkout-button", small: true, onPress: handleOnSubmit }, submitButtonText)))) : null,
102
- paymentFlowComponent));
90
+ React.createElement(Button, { testID: "confirm-checkout-button", small: true, onPress: handleOnSubmit }, submitButtonText)))) : null,
91
+ children));
103
92
  };
104
93
  export { Checkout };
@@ -24,9 +24,6 @@ declare const style: {
24
24
  paymentSelector: {
25
25
  marginTop: number;
26
26
  };
27
- paymentSelectorNL: {
28
- marginBottom: number;
29
- };
30
27
  princingWrapper: {
31
28
  padding: number;
32
29
  };
@@ -28,9 +28,6 @@ const style = StyleSheet.create({
28
28
  paymentSelector: {
29
29
  marginTop: space6,
30
30
  },
31
- paymentSelectorNL: {
32
- marginBottom: space6,
33
- },
34
31
  princingWrapper: {
35
32
  padding: space6,
36
33
  },
@@ -13,11 +13,10 @@ import { useTrackCheckout } from "../../../../../tracking/useTrackCheckout";
13
13
  import { useStaticInfo } from "../../../../hooks/useStaticInfo";
14
14
  import { useSubmitCheckout } from "../../../../hooks/useSubmitCheckout";
15
15
  import { Routes } from "../../../../routing/routes";
16
- import { useBasePath } from "../../../../routing/useBasePath";
17
16
  const CheckoutPaymentModal = ({ coupon, isFirstOrder, subscription, orderNumber, getAuthToken, onCheckoutSubmitted, }) => {
18
17
  const paymentFlowRef = useRef(null);
19
18
  const logger = useLogger();
20
- const { customer: { customerId, country, segment }, } = useStaticInfo();
19
+ const { customer: { customerId, country, segment }, basePath, } = useStaticInfo();
21
20
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
22
21
  const [paymentFlowPayload] = useViewPaymentFlowPayloadByCheckoutId({
23
22
  checkoutId: checkout?.id,
@@ -32,7 +31,6 @@ const CheckoutPaymentModal = ({ coupon, isFirstOrder, subscription, orderNumber,
32
31
  const loadAuthToken = async () => setAuthToken(await getAuthToken());
33
32
  loadAuthToken();
34
33
  }, [getAuthToken]);
35
- const basePath = useBasePath();
36
34
  const navigate = useNavigate();
37
35
  const trackCheckout = useTrackCheckout({
38
36
  page: TrackingPage.CHECKOUT,
@@ -1,12 +1,12 @@
1
- import React from "react";
1
+ import React, { useRef } from "react";
2
2
  import { PaymentInstrumentSelect, Section } from "@lookiero/payments-front";
3
- import { useStaticInfo } from "../../../../hooks/useStaticInfo";
3
+ import { useLogger } from "@lookiero/sty-psp-logging";
4
+ import { usePaymentInstrumentEvents } from "../../../../hooks/usePaymentInstrumentEvents";
4
5
  const PaymentInstrument = ({ useRedirect }) => {
6
+ const paymentInstrumentSelectRef = useRef(null);
5
7
  const { returnUrl } = useRedirect();
6
- const { customer } = useStaticInfo();
7
- return (React.createElement(PaymentInstrumentSelect, { beforeRedirect: returnUrl ? () => Promise.resolve(returnUrl) : undefined, hasError: false, section: Section.BOX_CHECKOUT, userInformation: {
8
- email: customer.email,
9
- name: customer.name,
10
- }, showSingleUsePaymentMethods: true }));
8
+ const logger = useLogger();
9
+ usePaymentInstrumentEvents({ logger });
10
+ return (React.createElement(PaymentInstrumentSelect, { ref: paymentInstrumentSelectRef, beforeRedirect: returnUrl ? () => Promise.resolve(returnUrl) : undefined, hasError: false, section: Section.BOX_CHECKOUT }));
11
11
  };
12
12
  export { PaymentInstrument };
@@ -21,7 +21,7 @@ import { Routes } from "../../routing/routes";
21
21
  import { style } from "./Summary.style";
22
22
  import { CollapsiblePricing } from "./components/collapsiblePricing/CollapsiblePricing";
23
23
  const Summary = ({ layout: Layout, children }) => {
24
- const { customer: { customerId, country, segment }, } = useStaticInfo();
24
+ const { customer: { customerId, country, segment }, basePath, } = useStaticInfo();
25
25
  const [pricingCollapsed, setPricingCollapsed] = useState(true);
26
26
  const [pricingHeight, setPricingHeight] = useState(0);
27
27
  const titleText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.SUMMARY_TITLE });
@@ -32,7 +32,6 @@ const Summary = ({ layout: Layout, children }) => {
32
32
  const [pricing, pricingStatus] = useViewPricingByCheckoutId({ checkoutId: checkout?.id });
33
33
  const [fiveItemsDiscount = 0, fiveItemsDiscountStatus] = useViewFiveItemsDiscountByCustomerId({ customerId });
34
34
  const navigate = useNavigate();
35
- const { basePath } = useStaticInfo();
36
35
  const match = useMatch(`${basePath}/${Routes.SUMMARY}/${Routes.SUMMARY_TABS}`);
37
36
  const tab = match?.params.tab;
38
37
  const trackPressPricing = useTrackPressPricing({
@@ -4,7 +4,5 @@ interface Customer {
4
4
  readonly customerId: string;
5
5
  readonly country: Country;
6
6
  readonly segment: Segment;
7
- readonly name: string;
8
- readonly email: string;
9
7
  }
10
8
  export type { Customer };
@@ -3,4 +3,4 @@ interface Order {
3
3
  readonly isFirstOrder: boolean;
4
4
  readonly coupon: string | null;
5
5
  }
6
- export type { Order as OrderProjection };
6
+ export type { Order };
@@ -1,2 +1,2 @@
1
1
  type Subscription = "o" | "m" | "b" | "q";
2
- export type { Subscription as SubscriptionProjection };
2
+ export type { Subscription };
@@ -1 +1 @@
1
- export declare const VERSION = "10.0.0-beta.4";
1
+ export declare const VERSION = "10.0.1";
@@ -1 +1 @@
1
- export const VERSION = "10.0.0-beta.4";
1
+ export const VERSION = "10.0.1";
@@ -7,57 +7,34 @@ import {
7
7
  RefAttributes,
8
8
  useImperativeHandle,
9
9
  } from "react";
10
- import { PaymentPayload } from "@lookiero/payments-front";
11
10
 
12
11
  const setPaymentsBridge = () => void 0;
13
12
  const PaymentsQueryProvider: FC<PropsWithChildren> = ({ children }) => children;
14
13
  const PaymentInstrumentSelect: FC = () => null;
15
-
14
+ interface StartLegacyBoxCheckoutCallbackArgs {
15
+ readonly status: string;
16
+ readonly final: boolean;
17
+ }
16
18
  interface StartLegacyBoxCheckoutFunction {
17
- (paymentFlowPayload: unknown): void;
19
+ (paymentFlowPayload: unknown, callback: (params: StartLegacyBoxCheckoutCallbackArgs) => Promise<void>): void;
18
20
  }
19
-
20
21
  interface PaymentFlowRef {
21
22
  readonly startLegacyBoxCheckout: StartLegacyBoxCheckoutFunction;
22
23
  }
23
-
24
24
  const paymentFlowRef: PaymentFlowRef = {
25
- startLegacyBoxCheckout: async () => {},
25
+ startLegacyBoxCheckout: async (_paymentFlowPayload, callback) => {
26
+ await callback({ status: "EXECUTED", final: true });
27
+ },
26
28
  };
27
-
28
29
  const PaymentFlow: ForwardRefExoticComponent<RefAttributes<PaymentFlowRef>> = forwardRef<PaymentFlowRef, unknown>(
29
30
  (_props, ref) => {
30
31
  useImperativeHandle(ref, () => paymentFlowRef, []);
31
32
  return null;
32
33
  },
33
34
  );
34
-
35
35
  PaymentFlow.displayName = "PaymentFlow";
36
-
37
- interface UsePaymentStatusManagerResult {
38
- isLoading: boolean;
39
- consumePayload: (callback: (payload: PaymentPayload) => void) => void;
40
- }
41
-
42
- const paymentStatusManagerResult: UsePaymentStatusManagerResult = {
43
- isLoading: false,
44
- consumePayload: (callback) => callback({ success: true } as PaymentPayload),
45
- };
46
-
47
- const usePaymentStatusManager: (section: Section) => UsePaymentStatusManagerResult = () => paymentStatusManagerResult;
48
-
49
36
  enum Section {
50
37
  BOX_CHECKOUT = "box-checkout",
51
38
  }
52
-
53
39
  export type { PaymentFlowRef };
54
-
55
- export {
56
- PaymentsQueryProvider,
57
- PaymentInstrumentSelect,
58
- PaymentFlow,
59
- Section,
60
- setPaymentsBridge,
61
- paymentFlowRef,
62
- usePaymentStatusManager,
63
- };
40
+ export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, paymentFlowRef };
package/index.ts CHANGED
@@ -5,6 +5,7 @@ import { fetchTranslations, translationEndpoint, translationExternalEndpoint } f
5
5
  import { Country, Locale } from "@lookiero/sty-psp-locale";
6
6
  import { SentryEnvironment, SentryLoggerFunctionArgs } from "@lookiero/sty-psp-logging";
7
7
  import { Segment } from "@lookiero/sty-psp-segment";
8
+ import { Tradename } from "@lookiero/sty-sp-tradename";
8
9
  import { CheckoutStatus } from "./src/domain/checkout/model/checkout";
9
10
  import { KameleoonEnvironment } from "./src/infrastructure/ab-testing/kameleoonEnvironment";
10
11
  import { bootstrap as checkoutBootstrap } from "./src/infrastructure/delivery/bootstrap";
@@ -13,8 +14,8 @@ import { DOMAIN } from "./src/infrastructure/ui/i18n/i18n";
13
14
  import { CheckoutProjection } from "./src/projection/checkout/checkout";
14
15
  import { viewFirstAvailableCheckoutByCustomerId } from "./src/projection/checkout/viewFirstAvailableCheckoutByCustomerId";
15
16
  import { Customer } from "./src/projection/customer/customer";
16
- import { OrderProjection } from "./src/projection/order/order";
17
- import { SubscriptionProjection } from "./src/projection/subscription/subscription";
17
+ import { Order } from "./src/projection/order/order";
18
+ import { Subscription } from "./src/projection/subscription/subscription";
18
19
 
19
20
  interface FirstAvailableCheckoutByCustomerIdFunctionArgs {
20
21
  readonly customerId: string | undefined;
@@ -57,12 +58,5 @@ const bootstrap: BootstrapFunction = ({ apiUrl, getAuthToken, translations, sent
57
58
  };
58
59
  };
59
60
 
60
- export { bootstrap, translationEndpoint, translationExternalEndpoint, Country, Segment, CheckoutStatus };
61
- export type {
62
- SentryEnvironment,
63
- KameleoonEnvironment,
64
- Customer,
65
- SubscriptionProjection as Subscription,
66
- OrderProjection as Order,
67
- Locale,
68
- };
61
+ export { bootstrap, translationEndpoint, translationExternalEndpoint, Country, Segment, CheckoutStatus, Tradename };
62
+ export type { SentryEnvironment, KameleoonEnvironment, Customer, Subscription, Order, Locale };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "10.0.0-beta.4",
3
+ "version": "10.0.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": "false",
@@ -32,6 +32,7 @@
32
32
  "@lookiero/sty-psp-segment": "^0.1",
33
33
  "@lookiero/sty-psp-storage": "^0.2",
34
34
  "@lookiero/sty-psp-tracking": "^0.2",
35
+ "@lookiero/sty-sp-tradename": "^0.1",
35
36
  "@lookiero/sty-psp-ui": "^0.7",
36
37
  "@lookiero/sty-psp-ui-settings": "^0.2",
37
38
  "@lookiero/sty-psp-units": "^0.1",
@@ -45,7 +46,7 @@
45
46
  "@cypress/webpack-preprocessor": "^6.0.2",
46
47
  "@lookiero/eslint-config-sty-psp": "*",
47
48
  "@lookiero/event": "^0.3",
48
- "@lookiero/payments-front": "7.0.0-alpha.3",
49
+ "@lookiero/payments-front": "6.0.3",
49
50
  "@lookiero/sty-psp-jest-config": "*",
50
51
  "@lookiero/sty-psp-prettier-config": "*",
51
52
  "@lookiero/sty-psp-scripts": "*",
@@ -75,7 +76,7 @@
75
76
  "@lookiero/event": "^0.3",
76
77
  "@lookiero/i18n": ">=2",
77
78
  "@lookiero/i18n-react": ">=2",
78
- "@lookiero/payments-front": "7.0.0-alpha.3",
79
+ "@lookiero/payments-front": "6.0.3",
79
80
  "apollo-boost": "0.4.4",
80
81
  "expo": ">=51",
81
82
  "expo-font": ">=12",
package/src/ExpoRoot.tsx CHANGED
@@ -1,4 +1,3 @@
1
- import { PortalProvider } from "@gorhom/portal";
2
1
  import { useFonts } from "expo-font";
3
2
  import "expo/build/Expo.fx";
4
3
  import React, { FC, useCallback, useState } from "react";
@@ -14,6 +13,7 @@ import { Country, Locale } from "@lookiero/sty-psp-locale";
14
13
  import { SentryEnvironment } from "@lookiero/sty-psp-logging";
15
14
  import { Segment } from "@lookiero/sty-psp-segment";
16
15
  import { DummyLayout } from "@lookiero/sty-psp-ui";
16
+ import { Tradename } from "@lookiero/sty-sp-tradename";
17
17
  import { KameleoonEnvironment } from "./infrastructure/ab-testing/kameleoonEnvironment";
18
18
  import { bootstrap as checkoutBootstrap } from "./infrastructure/delivery/bootstrap";
19
19
  import { bootstrap as checkoutMockBootstrap } from "./infrastructure/delivery/bootstrap.mock";
@@ -21,24 +21,22 @@ import { root } from "./infrastructure/ui/Root";
21
21
  import { DOMAIN } from "./infrastructure/ui/i18n/i18n";
22
22
  import { Router } from "./infrastructure/ui/routing/router/Router";
23
23
  import { Customer } from "./projection/customer/customer";
24
- import { OrderProjection } from "./projection/order/order";
25
- import { SubscriptionProjection } from "./projection/subscription/subscription";
24
+ import { Order } from "./projection/order/order";
25
+ import { Subscription } from "./projection/subscription/subscription";
26
26
  import { VERSION } from "./version";
27
27
 
28
- const locale: Locale = Locale.es_ES;
29
- const subscription: SubscriptionProjection = "b";
30
- const order: OrderProjection = {
28
+ const locale: Locale = Locale.en_GB;
29
+ const subscription: Subscription = "b";
30
+ const order: Order = {
31
31
  isFirstOrder: false,
32
32
  orderNumber: 3687582,
33
33
  coupon: "MYLOOKIERO",
34
34
  };
35
35
 
36
36
  const customer: Customer = {
37
- customerId: "9cfb056e-6008-44b1-9075-320479bf92ac",
38
- country: Country.NL,
37
+ customerId: "a4355713-469b-4684-bf90-3215702dfb1c",
38
+ country: Country.ES,
39
39
  segment: Segment.WOMEN,
40
- email: "email@example.com",
41
- name: "Adèle Léonce Émilie",
42
40
  };
43
41
 
44
42
  const sentryConfig: SentryEnvironment = {
@@ -55,7 +53,7 @@ const apiUrl =
55
53
  ? "/local-to-dev"
56
54
  : "/checkout/api";
57
55
  const authToken =
58
- "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU2NDk0NjYsImV4cCI6MTc0MjQ3MDI5OSwiZGlzcGxheU5hbWUiOiJNaWtlbCIsImNvdW50cnlfY29kZSI6IkVTIiwiYWNjZXNzVmlhIjoiZW1haWwiLCJzdWJzY3JpcHRpb25TdGFydGluZ0RhdGUiOiIyMDI0LTExLTExIiwiaW1wZXJzb25hdGVkIjpmYWxzZSwidXVpZCI6ImQzYzIzNTRiLTk4MTEtNDZkNC1iMmJhLTVmYmEwMTJlZDk0ZCIsImlhdCI6MTc0MDA1MTA5OX0.AkuUZTsn9mgplQwatg0dPKyv1Hsc6r267UMahxMH19g";
56
+ "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU2ODkxMDAsImV4cCI6MTc0NjI3ODQwMiwiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjUtMDQtMDMiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiYTQzNTU3MTMtNDY5Yi00Njg0LWJmOTAtMzIxNTcwMmRmYjFjIiwiaWF0IjoxNzQzNjg2NDAyfQ.pmqFo-4s0USFpzCnijRt78bWuBdu2Q7f4L9UtOkfAwo";
59
57
  const getAuthToken = () => Promise.resolve(authToken);
60
58
 
61
59
  const externalTranslationsUrl =
@@ -96,7 +94,6 @@ setPaymentsBridge({
96
94
  useFeatureFlags: () => ({}),
97
95
  locale: () => Promise.resolve("es-ES"),
98
96
  scrollView: ScrollView,
99
- hostUrl: "",
100
97
  });
101
98
 
102
99
  const kameleoonConfig: KameleoonEnvironment = {
@@ -134,38 +131,36 @@ const ExpoRoot: FC = () => {
134
131
  const onNotAccessible = useCallback(() => setIsAccessible(false), []);
135
132
 
136
133
  return fontsLoaded ? (
137
- <PortalProvider>
138
- <PaymentsQueryProvider>
139
- <EventProvider>
140
- <Aurora>
141
- {isAccessible === false && <Text heading={true}>Checkout is not accessible!</Text>}
134
+ <PaymentsQueryProvider>
135
+ <EventProvider>
136
+ <Aurora>
137
+ {isAccessible === false && <Text heading={true}>Checkout is not accessible!</Text>}
142
138
 
143
- <Router>
144
- <Routes>
145
- <Route
146
- path="/checkout/*"
147
- element={
148
- <Root
149
- basePath="/checkout"
150
- customer={customer}
151
- layout={DummyLayout}
152
- locale={locale}
153
- order={order}
154
- subscription={subscription}
155
- useRedirect={useRedirect}
156
- onCheckoutFlowSuccess={() => console.log("Checkout flow success!")}
157
- onNotAccessible={onNotAccessible}
158
- />
159
- }
160
- />
139
+ <Router>
140
+ <Routes>
141
+ <Route
142
+ path="/checkout/*"
143
+ element={
144
+ <Root
145
+ basePath="/checkout"
146
+ customer={customer}
147
+ layout={DummyLayout}
148
+ locale={locale}
149
+ order={order}
150
+ subscription={subscription}
151
+ tradename={Tradename.LOOKIERO}
152
+ useRedirect={useRedirect}
153
+ onNotAccessible={onNotAccessible}
154
+ />
155
+ }
156
+ />
161
157
 
162
- <Route element={<Navigate to="/checkout" replace />} path="*" />
163
- </Routes>
164
- </Router>
165
- </Aurora>
166
- </EventProvider>
167
- </PaymentsQueryProvider>
168
- </PortalProvider>
158
+ <Route element={<Navigate to="/checkout" replace />} path="*" />
159
+ </Routes>
160
+ </Router>
161
+ </Aurora>
162
+ </EventProvider>
163
+ </PaymentsQueryProvider>
169
164
  ) : null;
170
165
  };
171
166
 
@@ -1,5 +1,4 @@
1
1
  import { useCallback } from "react";
2
- import invariant from "tiny-invariant";
3
2
  import { CommandStatus, useCommand } from "@lookiero/messaging-react";
4
3
  import { Logger } from "@lookiero/sty-psp-logging";
5
4
  import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
@@ -14,7 +13,7 @@ interface BlockCheckoutBookingFunction {
14
13
  type UseBlockCheckoutBooking = [blockCheckoutBooking: BlockCheckoutBookingFunction, status: CommandStatus];
15
14
 
16
15
  interface UseBlockCheckoutBookingFunctionArgs {
17
- readonly checkoutBookingId: string | undefined;
16
+ readonly checkoutBookingId: string;
18
17
  readonly logger: Logger;
19
18
  }
20
19
 
@@ -27,8 +26,6 @@ const useBlockCheckoutBooking: UseBlockCheckoutBookingFunction = ({ checkoutBook
27
26
  const [createNotification] = useCreateToastNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
28
27
 
29
28
  const blockCheckoutBooking = useCallback(async () => {
30
- invariant(checkoutBookingId, "checkoutBookingId is required");
31
-
32
29
  try {
33
30
  await commandBus(
34
31
  blockCheckoutBookingCommand({
@@ -23,7 +23,7 @@ const DEFAULT_QUERY_OPTIONS: QueryOptions = {
23
23
  };
24
24
 
25
25
  interface UseViewPricingByCheckoutIdFunctionArgs {
26
- readonly checkoutId: string | undefined;
26
+ readonly checkoutId: string;
27
27
  readonly queryOptions?: QueryOptions;
28
28
  }
29
29
 
@@ -36,7 +36,7 @@ const useViewPricingByCheckoutId: UseViewPricingByCheckoutIdFunction = ({
36
36
  queryOptions = DEFAULT_QUERY_OPTIONS,
37
37
  }) =>
38
38
  useQuery({
39
- query: viewPricingByCheckoutId({ checkoutId: checkoutId as string }),
39
+ query: viewPricingByCheckoutId({ checkoutId }),
40
40
  contextId: MESSAGING_CONTEXT_ID,
41
41
  invalidation: shouldInvalidate,
42
42
  options: {
@@ -44,7 +44,6 @@ const useViewPricingByCheckoutId: UseViewPricingByCheckoutIdFunction = ({
44
44
  staleTime: Infinity,
45
45
  retry: false,
46
46
  refetchOnWindowFocus: false,
47
- enabled: Boolean(checkoutId),
48
47
  },
49
48
  });
50
49
 
@@ -2,7 +2,7 @@ import { BaseTrackingEvent, TrackingEventCategory } from "@lookiero/sty-psp-trac
2
2
  import { CheckoutItemStatus } from "../../domain/checkoutItem/model/checkoutItem";
3
3
  import { Currency } from "../../domain/checkoutItem/model/currency";
4
4
  import { MediaPerspective } from "../../projection/checkoutItem/checkoutItem";
5
- import { SubscriptionProjection } from "../../projection/subscription/subscription";
5
+ import { Subscription } from "../../projection/subscription/subscription";
6
6
 
7
7
  const PROJECT = "checkout";
8
8
 
@@ -121,7 +121,7 @@ interface CheckoutTrackingEvent
121
121
  readonly actionField: {
122
122
  readonly items: number;
123
123
  readonly currencyCode: Currency;
124
- readonly subscription: SubscriptionProjection;
124
+ readonly subscription: Subscription;
125
125
  readonly coupon: string | null;
126
126
  readonly orderId: number;
127
127
  readonly value: number;