@lookiero/checkout 11.4.0 → 12.0.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 (39) hide show
  1. package/dist/index.d.ts +2 -2
  2. package/dist/src/ExpoRoot.d.ts +0 -1
  3. package/dist/src/ExpoRoot.js +7 -4
  4. package/dist/src/infrastructure/ui/routing/CheckoutMiddleware.d.ts +1 -1
  5. package/dist/src/infrastructure/ui/routing/CheckoutMiddleware.js +4 -2
  6. package/dist/src/infrastructure/ui/test/render.js +1 -1
  7. package/dist/src/infrastructure/ui/views/App.d.ts +1 -1
  8. package/dist/src/projection/returnQuestion/returnQuestion.typeguard.d.ts +2 -2
  9. package/dist/src/version.d.ts +1 -1
  10. package/dist/src/version.js +1 -1
  11. package/index.ts +2 -1
  12. package/jest.config.js +0 -3
  13. package/jest.setup.js +9 -1
  14. package/package.json +23 -21
  15. package/src/ExpoRoot.tsx +8 -5
  16. package/src/infrastructure/ui/hooks/useCheckoutFlow.test.tsx +11 -1
  17. package/src/infrastructure/ui/hooks/useQueryBus.test.tsx +1 -1
  18. package/src/infrastructure/ui/hooks/useStaticInfo.test.tsx +1 -1
  19. package/src/infrastructure/ui/routing/CheckoutMiddleware.tsx +5 -3
  20. package/src/infrastructure/ui/test/render.tsx +1 -1
  21. package/src/infrastructure/ui/views/App.tsx +1 -1
  22. package/src/infrastructure/ui/views/checkout/Checkout.test.tsx +9 -2
  23. package/src/infrastructure/ui/views/feedback/Feedback.test.tsx +7 -1
  24. package/src/infrastructure/ui/views/item/Item.test.tsx +7 -1
  25. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/__snapshots__/GetOutOfCheckoutModal.test.tsx.snap +34 -43
  26. package/src/infrastructure/ui/views/item/components/itemActions/__snapshots__/ItemActions.test.tsx.snap +34 -43
  27. package/src/infrastructure/ui/views/item/components/productVariantSlider/__snapshots__/ProductVariantSlider.test.tsx.snap +76 -99
  28. package/src/infrastructure/ui/views/item/components/selectModal/__snapshots__/SelecModal.test.tsx.snap +34 -43
  29. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/__snapshots__/SizeWithoutStockModal.test.tsx.snap +34 -43
  30. package/src/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.test.tsx +7 -1
  31. package/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.test.tsx +7 -1
  32. package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +228 -297
  33. package/src/infrastructure/ui/views/return/Return.test.tsx +8 -1
  34. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.test.tsx +2 -1
  35. package/src/infrastructure/ui/views/shared/components/productVariant/__snapshots__/ProductVariant.test.tsx.snap +26 -32
  36. package/src/infrastructure/ui/views/summary/Summary.test.tsx +7 -1
  37. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/__snapshots__/CollapsiblePricing.test.tsx.snap +16 -24
  38. package/src/infrastructure/ui/views/summaryTabs/SummaryTabs.test.tsx +7 -1
  39. package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/__snapshots__/CheckoutItemsTabs.test.tsx.snap +105 -135
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ComponentType } from "react";
2
2
  import { EndpointFunction } from "@lookiero/i18n";
3
- import { translationEndpoint, translationExternalEndpoint } from "@lookiero/sty-psp-i18n";
3
+ import { translationEndpoint, translationExternalEndpoint, Project } from "@lookiero/sty-psp-i18n";
4
4
  import { Country, Locale } from "@lookiero/sty-psp-locale";
5
5
  import { SentryEnvironment, SentryLoggerFunctionArgs } from "@lookiero/sty-psp-logging";
6
6
  import { Segment } from "@lookiero/sty-psp-segment";
@@ -34,4 +34,4 @@ interface BootstrapFunction {
34
34
  }
35
35
  declare const bootstrap: BootstrapFunction;
36
36
  export { bootstrap, translationEndpoint, translationExternalEndpoint, Country, Segment, CheckoutStatus, Tradename };
37
- export type { SentryEnvironment, KameleoonEnvironment, Customer, SubscriptionProjection as Subscription, OrderProjection as Order, Locale, };
37
+ export type { Project, SentryEnvironment, KameleoonEnvironment, Customer, SubscriptionProjection as Subscription, OrderProjection as Order, Locale, };
@@ -1,4 +1,3 @@
1
- import "expo/build/Expo.fx";
2
1
  import { FC } from "react";
3
2
  declare const ExpoRoot: FC;
4
3
  export { ExpoRoot };
@@ -1,6 +1,5 @@
1
1
  import { PortalProvider } from "@gorhom/portal";
2
2
  import { useFonts } from "expo-font";
3
- import "expo/build/Expo.fx";
4
3
  import React, { useCallback, useState } from "react";
5
4
  import { Platform, ScrollView } from "react-native";
6
5
  import { Navigate, Route, Routes } from "react-router-native";
@@ -29,7 +28,7 @@ const order = {
29
28
  coupon: "MYLOOKIERO",
30
29
  };
31
30
  const customer = {
32
- customerId: "dd186ec9-109f-418d-a770-c6721aa2a97e",
31
+ customerId: "5c38e826-3d01-4a4b-a3d1-8a4166dc2a31",
33
32
  country: Country.NL,
34
33
  segment: Segment.WOMEN,
35
34
  email: "email@example.com",
@@ -46,17 +45,21 @@ const apiUrl = Platform.OS !== "web"
46
45
  : __DEV__
47
46
  ? "/local-to-dev"
48
47
  : "/checkout/api";
49
- const authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU2OTUxOTEsImV4cCI6MTc0ODA3NzU5NSwiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjUtMDQtMjQiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiZGQxODZlYzktMTA5Zi00MThkLWE3NzAtYzY3MjFhYTJhOTdlIiwidHJhZGVuYW1lIjoiTE9PS0lFUk8iLCJpYXQiOjE3NDU0ODU1OTV9.MHdtbMWX4lUU98ARiGALsUNkoqu1wKN7Qd-fCv6oqi4";
48
+ const authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU3MDEwMTIsImV4cCI6MTc1MDMyMTgwOSwiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjUtMDUtMTkiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiNWMzOGU4MjYtM2QwMS00YTRiLWEzZDEtOGE0MTY2ZGMyYTMxIiwidHJhZGVuYW1lIjoiTE9PS0lFUk8iLCJpYXQiOjE3NDc2NDM0MDl9.-amqZAXKy9KKeo9a7bOQigWw1flM99OBlddxbMBA_PU";
50
49
  const getAuthToken = () => Promise.resolve(authToken);
51
50
  const externalTranslationsUrl = Platform.OS !== "web"
52
51
  ? "https://backend-for-user.dev.envs.lookiero.tech/api/v2/translations"
53
52
  : __DEV__
54
53
  ? "/local-to-external-i18n"
55
54
  : "/external-i18n";
55
+ const translationProjectsByTradename = {
56
+ [Tradename.LOOKIERO]: [["checkout"], ["inventory-catalog"]],
57
+ [Tradename.OUTFITTERY]: [["outfittery-checkout"], ["inventory-catalog"]],
58
+ };
56
59
  const translations = [
57
60
  (locale) => translationExternalEndpoint({
58
61
  translationsUrl: externalTranslationsUrl,
59
- projects: [["checkout"], ["inventory-catalog"]],
62
+ projects: translationProjectsByTradename[tradename],
60
63
  })(locale),
61
64
  ];
62
65
  const useRedirect = () => ({
@@ -1,4 +1,4 @@
1
- import { FC } from "react";
1
+ import { FC, JSX } from "react";
2
2
  interface CheckoutMiddlewareProps {
3
3
  readonly customerId: string;
4
4
  readonly onNotAccessible: () => void;
@@ -34,7 +34,7 @@ const CheckoutMiddleware = ({ customerId, onNotAccessible, loader = React.create
34
34
  const feedbackRouteMatchRef = useRef(feedbackRouteMatch);
35
35
  feedbackRouteMatchRef.current = feedbackRouteMatch;
36
36
  const [checkout] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
37
- const checkoutItemsRef = useRef();
37
+ const checkoutItemsRef = useRef([]);
38
38
  /* This hook is mounted at this level, although not being used directly, for optimization (regarding cache) */
39
39
  useViewIsSizeChangeEnabledByCheckoutId({ checkoutId: checkout?.id });
40
40
  const [startCheckout] = useStartCheckout({ checkoutId: checkout?.id, logger });
@@ -55,7 +55,9 @@ const CheckoutMiddleware = ({ customerId, onNotAccessible, loader = React.create
55
55
  */
56
56
  const itemWithoutCustomerDecision = checkout?.items.find((item) => item.status === CheckoutItemStatus.INITIAL &&
57
57
  checkoutItemsRef.current?.find((previousItem) => previousItem.id === item.id && previousItem.status !== CheckoutItemStatus.INITIAL)) || checkout?.items.find((item) => item.status === CheckoutItemStatus.INITIAL);
58
- checkoutItemsRef.current = checkout?.items;
58
+ if (checkout) {
59
+ checkoutItemsRef.current = checkout.items;
60
+ }
59
61
  /* Navigate to the summary if required */
60
62
  if (itemWithoutCustomerDecision === undefined &&
61
63
  !(summaryRouteMatchRef.current ||
@@ -9,7 +9,7 @@ const I18nProvider = createI18nProvider({ domain: DOMAIN });
9
9
  const renderWrapper = ({ locale, messages = {}, wrapper: Wrapper = Fragment, logger = mock() }) =>
10
10
  // eslint-disable-next-line react/display-name, react/prop-types
11
11
  ({ children }) => (React.createElement(Aurora, null,
12
- React.createElement(I18nProvider, { locale: locale, messages: messages, onError: () => void 0 },
12
+ React.createElement(I18nProvider, { locale: locale, messages: messages, onError: () => { }, onWarn: () => { } },
13
13
  React.createElement(LoggerProvider, { logger: logger },
14
14
  React.createElement(Wrapper, null, children)))));
15
15
  const renderWithProviders = (ui, { locale, messages, wrapper } = { locale: "en" }) => render(ui, { wrapper: renderWrapper({ locale, messages, wrapper }) });
@@ -1,4 +1,4 @@
1
- import { FC } from "react";
1
+ import { FC, JSX } from "react";
2
2
  interface AppProps {
3
3
  readonly children: JSX.Element;
4
4
  }
@@ -1,5 +1,5 @@
1
- import { ReturnQuestionProjection, ReturnQuestionTypesWithChildren } from "./returnQuestion";
1
+ import { ReturnQuestionProjection, ReturnQuestionTypesWithChildren, ReturnQuestionTypesWithOptionalTranslationKeys } from "./returnQuestion";
2
2
  import { ReturnQuestionType } from "./returnQuestion.constants";
3
- declare const returnQuestionWithTranslationKey: (question: ReturnQuestionProjection) => question is ReturnQuestionProjection<ReturnQuestionType.HOST_DEFAULT | ReturnQuestionType.HOST_TEXTAREA | ReturnQuestionType.HOST_SELECT | ReturnQuestionType.TEXTAREA | ReturnQuestionType.OPTION>;
3
+ declare const returnQuestionWithTranslationKey: (question: ReturnQuestionProjection) => question is ReturnQuestionProjection<Exclude<ReturnQuestionType, ReturnQuestionTypesWithOptionalTranslationKeys>>;
4
4
  declare const returnQuestionHasChildren: (question: ReturnQuestionProjection) => question is ReturnQuestionProjection<ReturnQuestionTypesWithChildren>;
5
5
  export { returnQuestionWithTranslationKey, returnQuestionHasChildren };
@@ -1 +1 @@
1
- export declare const VERSION = "11.4.0";
1
+ export declare const VERSION = "12.0.0";
@@ -1 +1 @@
1
- export const VERSION = "11.4.0";
1
+ export const VERSION = "12.0.0";
package/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ComponentType } from "react";
2
2
  import { EndpointFunction } from "@lookiero/i18n";
3
3
  import { i18n } from "@lookiero/i18n-react";
4
- import { fetchTranslations, translationEndpoint, translationExternalEndpoint } from "@lookiero/sty-psp-i18n";
4
+ import { fetchTranslations, translationEndpoint, translationExternalEndpoint, Project } from "@lookiero/sty-psp-i18n";
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";
@@ -60,6 +60,7 @@ const bootstrap: BootstrapFunction = ({ apiUrl, getAuthToken, translations, sent
60
60
 
61
61
  export { bootstrap, translationEndpoint, translationExternalEndpoint, Country, Segment, CheckoutStatus, Tradename };
62
62
  export type {
63
+ Project,
63
64
  SentryEnvironment,
64
65
  KameleoonEnvironment,
65
66
  Customer,
package/jest.config.js CHANGED
@@ -4,7 +4,4 @@ module.exports = {
4
4
  ...jestReactNativeConfig,
5
5
  setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
6
6
  setupFiles: ["../../node_modules/react-native-gesture-handler/jestSetup.js"],
7
- moduleNameMapper: {
8
- ...(jestReactNativeConfig.moduleNameMapper || {}),
9
- },
10
7
  };
package/jest.setup.js CHANGED
@@ -1,9 +1,17 @@
1
1
  import mockAsyncStorage from "@react-native-async-storage/async-storage/jest/async-storage-mock";
2
- import "@testing-library/jest-native/extend-expect";
3
2
  import "@lookiero/sty-psp-jest-config/jest.setup.base";
4
3
 
5
4
  require("react-native-reanimated").setUpTests();
6
5
 
6
+ jest.mock('react-native-reanimated', () => {
7
+ const Reanimated = jest.requireActual('react-native-reanimated/mock');
8
+
9
+ // Override call to prevent warnings in newer versions
10
+ Reanimated.default.call = () => {};
11
+
12
+ return Reanimated;
13
+ });
14
+
7
15
  jest.mock("@react-native-async-storage/async-storage", () => mockAsyncStorage);
8
16
 
9
17
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "11.4.0",
3
+ "version": "12.0.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": "false",
@@ -22,23 +22,23 @@
22
22
  "@lookiero/messaging": "^8.1.1",
23
23
  "@lookiero/messaging-react": "^8.1.1",
24
24
  "@lookiero/sty-psp-ab-testing": "^0.3",
25
- "@lookiero/sty-psp-expo-config": "^0.2",
25
+ "@lookiero/sty-psp-expo-config": "^1.0",
26
26
  "@lookiero/sty-psp-http": "^2.0",
27
- "@lookiero/sty-psp-i18n": "^0.4",
27
+ "@lookiero/sty-psp-i18n": "^1.0",
28
28
  "@lookiero/sty-psp-locale": "^0.4",
29
- "@lookiero/sty-psp-logging": "^0.5",
30
- "@lookiero/sty-psp-notifications": "^1.1",
31
- "@lookiero/sty-psp-react-native": "^0.3",
29
+ "@lookiero/sty-psp-logging": "^1.0",
30
+ "@lookiero/sty-psp-notifications": "^2.0",
31
+ "@lookiero/sty-psp-react-native": "^1.0",
32
32
  "@lookiero/sty-psp-segment": "^0.1",
33
33
  "@lookiero/sty-psp-storage": "^0.2",
34
- "@lookiero/sty-psp-tracking": "^0.2",
35
- "@lookiero/sty-sp-tradename": "^1.0",
36
- "@lookiero/sty-psp-ui": "^1.1",
37
- "@lookiero/sty-psp-ui-settings": "^0.2",
34
+ "@lookiero/sty-psp-tracking": "^1.0",
35
+ "@lookiero/sty-psp-ui": "^2.0",
36
+ "@lookiero/sty-psp-ui-settings": "^1.0",
38
37
  "@lookiero/sty-psp-units": "^0.1",
39
38
  "@lookiero/sty-psp-uuid": "^0.2",
39
+ "@lookiero/sty-sp-tradename": "^1.0",
40
40
  "react-native-keyboard-aware-scroll-view": "^0.9.5",
41
- "react-native-svg": "15.2.0",
41
+ "react-native-svg": "15.8.0",
42
42
  "tiny-invariant": "^1.3.1"
43
43
  },
44
44
  "devDependencies": {
@@ -52,20 +52,22 @@
52
52
  "@lookiero/sty-psp-scripts": "*",
53
53
  "@lookiero/sty-psp-typescript": "*",
54
54
  "@react-native-async-storage/async-storage": "1.23.1",
55
+ "@react-native/assets-registry": "^0.79.2",
55
56
  "@remix-run/router": ">=1.10",
56
- "@testing-library/react-native": ">=12",
57
+ "@testing-library/react-native": ">=13",
57
58
  "@types/jest-when": ">=3",
58
59
  "apollo-boost": "0.4.4",
59
60
  "buffer": "5.6.0",
60
61
  "cypress": "^13.14.2",
61
62
  "detox": "^20.11.0",
62
- "expo-crypto": "~13.0.2",
63
+ "expo-crypto": "~14.0.2",
63
64
  "jest-mock-extended": ">=3",
64
65
  "jest-when": ">=3",
65
- "react-native-gesture-handler": "~2.16.1",
66
+ "metro": "^0.81.0",
67
+ "react-native-gesture-handler": "~2.20.2",
66
68
  "react-native-get-random-values": "~1.11.0",
67
- "react-native-reanimated": "~3.10.1",
68
- "react-native-safe-area-context": "4.10.5",
69
+ "react-native-reanimated": "~3.16.1",
70
+ "react-native-safe-area-context": "4.12.0",
69
71
  "webpack-bundle-analyzer": "^4.10.2"
70
72
  },
71
73
  "peerDependencies": {
@@ -77,14 +79,14 @@
77
79
  "@lookiero/i18n-react": ">=2",
78
80
  "@lookiero/payments-front": ">=7",
79
81
  "apollo-boost": "0.4.4",
80
- "expo": ">=51",
82
+ "expo": ">=52",
81
83
  "expo-font": ">=12",
82
84
  "react": ">=18",
83
- "react-native": ">=0.74",
84
- "react-native-gesture-handler": "~2.16.1",
85
+ "react-native": ">=0.76",
86
+ "react-native-gesture-handler": ">=2.20",
85
87
  "react-native-get-random-values": ">=1.11",
86
- "react-native-reanimated": "~3.10.1",
87
- "react-native-safe-area-context": ">=4.10",
88
+ "react-native-reanimated": ">=3.16",
89
+ "react-native-safe-area-context": ">=4.12",
88
90
  "react-router-dom": ">=6.14",
89
91
  "react-router-native": ">=6.14",
90
92
  "uuid": ">=9"
package/src/ExpoRoot.tsx CHANGED
@@ -1,6 +1,5 @@
1
1
  import { PortalProvider } from "@gorhom/portal";
2
2
  import { useFonts } from "expo-font";
3
- import "expo/build/Expo.fx";
4
3
  import React, { FC, useCallback, useState } from "react";
5
4
  import { Platform, ScrollView } from "react-native";
6
5
  import { Navigate, Route, Routes } from "react-router-native";
@@ -9,7 +8,7 @@ import { EventProvider } from "@lookiero/event";
9
8
  import { EndpointFunction } from "@lookiero/i18n";
10
9
  import { i18n } from "@lookiero/i18n-react";
11
10
  import { PaymentsQueryProvider, setPaymentsBridge } from "@lookiero/payments-front";
12
- import { fetchTranslations, translationExternalEndpoint } from "@lookiero/sty-psp-i18n";
11
+ import { fetchTranslations, Project, translationExternalEndpoint } from "@lookiero/sty-psp-i18n";
13
12
  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";
@@ -38,7 +37,7 @@ const order: OrderProjection = {
38
37
  };
39
38
 
40
39
  const customer: Customer = {
41
- customerId: "dd186ec9-109f-418d-a770-c6721aa2a97e",
40
+ customerId: "5c38e826-3d01-4a4b-a3d1-8a4166dc2a31",
42
41
  country: Country.NL,
43
42
  segment: Segment.WOMEN,
44
43
  email: "email@example.com",
@@ -59,7 +58,7 @@ const apiUrl =
59
58
  ? "/local-to-dev"
60
59
  : "/checkout/api";
61
60
  const authToken =
62
- "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU2OTUxOTEsImV4cCI6MTc0ODA3NzU5NSwiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjUtMDQtMjQiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiZGQxODZlYzktMTA5Zi00MThkLWE3NzAtYzY3MjFhYTJhOTdlIiwidHJhZGVuYW1lIjoiTE9PS0lFUk8iLCJpYXQiOjE3NDU0ODU1OTV9.MHdtbMWX4lUU98ARiGALsUNkoqu1wKN7Qd-fCv6oqi4";
61
+ "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU3MDEwMTIsImV4cCI6MTc1MDMyMTgwOSwiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjUtMDUtMTkiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiNWMzOGU4MjYtM2QwMS00YTRiLWEzZDEtOGE0MTY2ZGMyYTMxIiwidHJhZGVuYW1lIjoiTE9PS0lFUk8iLCJpYXQiOjE3NDc2NDM0MDl9.-amqZAXKy9KKeo9a7bOQigWw1flM99OBlddxbMBA_PU";
63
62
  const getAuthToken = () => Promise.resolve(authToken);
64
63
 
65
64
  const externalTranslationsUrl =
@@ -68,11 +67,15 @@ const externalTranslationsUrl =
68
67
  : __DEV__
69
68
  ? "/local-to-external-i18n"
70
69
  : "/external-i18n";
70
+ const translationProjectsByTradename: Record<Tradename, [project: Project, filter?: string][]> = {
71
+ [Tradename.LOOKIERO]: [["checkout"], ["inventory-catalog"]],
72
+ [Tradename.OUTFITTERY]: [["outfittery-checkout"], ["inventory-catalog"]],
73
+ };
71
74
  const translations: EndpointFunction[] = [
72
75
  (locale) =>
73
76
  translationExternalEndpoint({
74
77
  translationsUrl: externalTranslationsUrl,
75
- projects: [["checkout"], ["inventory-catalog"]],
78
+ projects: translationProjectsByTradename[tradename],
76
79
  })(locale),
77
80
  ];
78
81
 
@@ -6,6 +6,7 @@ import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp
6
6
  import { Segment } from "@lookiero/sty-psp-segment";
7
7
  import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
8
8
  import { CheckoutBookingProjection } from "../../../projection/checkoutBooking/checkoutBooking";
9
+ import { Customer } from "../../../projection/customer/customer";
9
10
  import { OrderProjection } from "../../../projection/order/order";
10
11
  import { SubscriptionProjection } from "../../../projection/subscription/subscription";
11
12
  import { useSubmitCheckout } from "../../domain/checkout/react/useSubmitCheckout";
@@ -45,8 +46,17 @@ const country = Country.ES;
45
46
  const email = "email@example.com";
46
47
  const name = "Adèle Léonce Émilie";
47
48
  const segment = Segment.WOMEN;
49
+
50
+ const mockCustomer: Customer = {
51
+ customerId,
52
+ country,
53
+ segment,
54
+ name,
55
+ email,
56
+ };
57
+
48
58
  jest.mock("./useStaticInfo", () => ({
49
- useStaticInfo: () => ({ customer: { customerId, country, segment, name, email }, basePath }),
59
+ useStaticInfo: () => ({ customer: mockCustomer, basePath }),
50
60
  }));
51
61
 
52
62
  // const errorChargeStatuses = Object.values(ChargeStatus).filter((status) => status !== ChargeStatus.EXECUTED);
@@ -1,6 +1,6 @@
1
1
  import { renderHook, waitFor } from "@testing-library/react-native";
2
2
  import { mockFn } from "jest-mock-extended";
3
- import React, { FC } from "react";
3
+ import React, { FC, JSX } from "react";
4
4
  import { QueryBus } from "@lookiero/messaging";
5
5
  import { QueryBusProvider, useQueryBus as sut } from "./useQueryBus";
6
6
 
@@ -1,5 +1,5 @@
1
1
  import { renderHook, waitFor } from "@testing-library/react-native";
2
- import React, { FC } from "react";
2
+ import React, { FC, JSX } from "react";
3
3
  import { Tradename } from "@lookiero/sty-sp-tradename";
4
4
  import { Customer } from "../../../projection/customer/customer";
5
5
  import { KameleoonEnvironment } from "../../ab-testing/kameleoonEnvironment";
@@ -1,4 +1,4 @@
1
- import React, { FC, useEffect, useRef } from "react";
1
+ import React, { FC, JSX, useEffect, useRef } from "react";
2
2
  import { generatePath, useMatch, useNavigate } from "react-router-native";
3
3
  import { Spinner } from "@lookiero/aurora";
4
4
  import { useLogger } from "@lookiero/sty-psp-logging";
@@ -50,7 +50,7 @@ const CheckoutMiddleware: FC<CheckoutMiddlewareProps> = ({
50
50
  feedbackRouteMatchRef.current = feedbackRouteMatch;
51
51
 
52
52
  const [checkout] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
53
- const checkoutItemsRef = useRef<CheckoutItemProjection[]>();
53
+ const checkoutItemsRef = useRef<CheckoutItemProjection[]>([]);
54
54
 
55
55
  /* This hook is mounted at this level, although not being used directly, for optimization (regarding cache) */
56
56
  useViewIsSizeChangeEnabledByCheckoutId({ checkoutId: checkout?.id });
@@ -84,7 +84,9 @@ const CheckoutMiddleware: FC<CheckoutMiddlewareProps> = ({
84
84
  ),
85
85
  ) || checkout?.items.find((item) => item.status === CheckoutItemStatus.INITIAL);
86
86
 
87
- checkoutItemsRef.current = checkout?.items;
87
+ if (checkout) {
88
+ checkoutItemsRef.current = checkout.items;
89
+ }
88
90
 
89
91
  /* Navigate to the summary if required */
90
92
  if (
@@ -26,7 +26,7 @@ const renderWrapper: RenderWrapperFunction =
26
26
  // eslint-disable-next-line react/display-name, react/prop-types
27
27
  ({ children }) => (
28
28
  <Aurora>
29
- <I18nProvider locale={locale as string} messages={messages} onError={() => void 0}>
29
+ <I18nProvider locale={locale as string} messages={messages} onError={() => {}} onWarn={() => {}}>
30
30
  <LoggerProvider logger={logger}>
31
31
  <Wrapper>{children}</Wrapper>
32
32
  </LoggerProvider>
@@ -1,5 +1,5 @@
1
1
  import { PortalHost } from "@gorhom/portal";
2
- import React, { FC } from "react";
2
+ import React, { FC, JSX } from "react";
3
3
  import { StatusBar } from "react-native";
4
4
  import { SafeAreaProvider } from "react-native-safe-area-context";
5
5
  import { Notifications } from "@lookiero/sty-psp-notifications";
@@ -6,6 +6,7 @@ import { Country } from "@lookiero/sty-psp-locale";
6
6
  import { Segment } from "@lookiero/sty-psp-segment";
7
7
  import { DummyLayout } from "@lookiero/sty-psp-ui";
8
8
  import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
9
+ import { Customer } from "../../../../projection/customer/customer";
9
10
  import { OrderProjection } from "../../../../projection/order/order";
10
11
  import { SubscriptionProjection } from "../../../../projection/subscription/subscription";
11
12
  import { checkout } from "../../../projection/checkout/checkout.mock";
@@ -22,6 +23,11 @@ const customerId = "a8fff6d7-708c-41a7-b42a-58c5706d33df";
22
23
  const basePath = "/checkout";
23
24
  const country = Country.ES;
24
25
  const segment = Segment.WOMEN;
26
+ const mockCustomer: Customer = {
27
+ customerId,
28
+ country,
29
+ segment,
30
+ } as Customer;
25
31
  const mockCheckout = checkout({
26
32
  items: [
27
33
  { status: CheckoutItemStatus.RETURNED },
@@ -41,14 +47,15 @@ const mockUseRedirect = jest.fn(() => ({ returnUrl: "https://web2.dev.aws.lookie
41
47
 
42
48
  const mockOnSuccess = jest.fn();
43
49
  const mockCheckoutFlow = jest.fn();
50
+ const mockStatus = QueryStatus.SUCCESS;
44
51
  const paymentFlowTestId = "payment-flow";
45
52
  const mockPaymentFlowComponent: ReactNode = <View testID={paymentFlowTestId}>PaymentFlow</View>;
46
53
  jest.mock("../../hooks/useCheckoutFlow", () => ({
47
- useCheckoutFlow: () => [mockCheckoutFlow, QueryStatus.SUCCESS, mockPaymentFlowComponent],
54
+ useCheckoutFlow: () => [mockCheckoutFlow, mockStatus, mockPaymentFlowComponent],
48
55
  }));
49
56
 
50
57
  jest.mock("../../hooks/useStaticInfo", () => ({
51
- useStaticInfo: () => ({ customer: { customerId, country, segment }, basePath }),
58
+ useStaticInfo: () => ({ customer: mockCustomer, basePath }),
52
59
  }));
53
60
  // eslint-disable-next-line @typescript-eslint/naming-convention
54
61
  jest.mock("./components/paymentInstrument/PaymentInstrument", () => ({ PaymentInstrument: () => null }));
@@ -5,6 +5,7 @@ import { Country } from "@lookiero/sty-psp-locale";
5
5
  import { Segment } from "@lookiero/sty-psp-segment";
6
6
  import { DummyLayout } from "@lookiero/sty-psp-ui";
7
7
  import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
8
+ import { Customer } from "../../../../projection/customer/customer";
8
9
  import { useGiveCheckoutFeedback } from "../../../domain/checkoutFeedback/react/useGiveCheckoutFeedback";
9
10
  import { checkout } from "../../../projection/checkout/checkout.mock";
10
11
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
@@ -25,9 +26,14 @@ const checkoutMock = checkout({
25
26
  ],
26
27
  });
27
28
  const mockGiveCheckoutFeedback = jest.fn();
29
+ const mockCustomer: Customer = {
30
+ customerId,
31
+ country,
32
+ segment,
33
+ } as Customer;
28
34
 
29
35
  jest.mock("../../hooks/useStaticInfo", () => ({
30
- useStaticInfo: () => ({ customer: { customerId, country, segment } }),
36
+ useStaticInfo: () => ({ customer: mockCustomer }),
31
37
  }));
32
38
 
33
39
  jest.mock("../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId");
@@ -5,6 +5,7 @@ import { Country } from "@lookiero/sty-psp-locale";
5
5
  import { Segment } from "@lookiero/sty-psp-segment";
6
6
  import { DummyLayout } from "@lookiero/sty-psp-ui";
7
7
  import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
8
+ import { Customer } from "../../../../projection/customer/customer";
8
9
  import { useBookCheckoutBookingForCheckoutItem } from "../../../domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem";
9
10
  import { useKeepCheckoutItem } from "../../../domain/checkoutItem/react/useKeepCheckoutItem";
10
11
  import { useReplaceCheckoutItem } from "../../../domain/checkoutItem/react/useReplaceCheckoutItem";
@@ -26,9 +27,14 @@ const mockFirstCheckoutItemId = "a5422445-0e62-4b11-8a3f-1bb5469ee154";
26
27
  const customerId = "a8fff6d7-708c-41a7-b42a-58c5706d33df";
27
28
  const country = Country.ES;
28
29
  const segment = Segment.WOMEN;
30
+ const mockCustomer: Customer = {
31
+ customerId,
32
+ country,
33
+ segment,
34
+ } as Customer;
29
35
 
30
36
  jest.mock("../../hooks/useStaticInfo", () => ({
31
- useStaticInfo: () => ({ customer: { customerId, country, segment } }),
37
+ useStaticInfo: () => ({ customer: mockCustomer }),
32
38
  }));
33
39
 
34
40
  const mockNavigate = jest.fn();
@@ -58,15 +58,7 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
58
58
  }
59
59
  }
60
60
  accessible={true}
61
- collapsable={false}
62
61
  focusable={true}
63
- jestAnimatedStyle={
64
- {
65
- "value": {
66
- "opacity": 1,
67
- },
68
- }
69
- }
70
62
  onClick={[Function]}
71
63
  onResponderGrant={[Function]}
72
64
  onResponderMove={[Function]}
@@ -75,14 +67,19 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
75
67
  onResponderTerminationRequest={[Function]}
76
68
  onStartShouldSetResponder={[Function]}
77
69
  style={
78
- {
79
- "backgroundColor": "rgba(12, 10, 10, 0.7)",
80
- "height": "100%",
81
- "opacity": 1,
82
- "position": "absolute",
83
- "width": "100%",
84
- "zIndex": 1,
85
- }
70
+ [
71
+ {
72
+ "backgroundColor": "rgba(12, 10, 10, 0.7)",
73
+ "height": "100%",
74
+ "position": "absolute",
75
+ "width": "100%",
76
+ "zIndex": 1,
77
+ },
78
+ undefined,
79
+ {
80
+ "opacity": 1,
81
+ },
82
+ ]
86
83
  }
87
84
  testID="modal-close-button"
88
85
  />
@@ -116,10 +113,26 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
116
113
  }
117
114
  >
118
115
  <View
119
- collapsable={false}
120
- jestAnimatedStyle={
121
- {
122
- "value": {
116
+ pointerEvents="auto"
117
+ style={
118
+ [
119
+ {
120
+ "backgroundColor": "#FFFFFF",
121
+ "borderRadius": 16,
122
+ "position": "absolute",
123
+ "width": "100%",
124
+ "zIndex": 3,
125
+ },
126
+ {
127
+ "borderBottomLeftRadius": 0,
128
+ "borderBottomRightRadius": 0,
129
+ },
130
+ undefined,
131
+ {
132
+ "maxHeight": 800,
133
+ },
134
+ undefined,
135
+ {
123
136
  "opacity": 1,
124
137
  "transform": [
125
138
  {
@@ -130,29 +143,7 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
130
143
  },
131
144
  ],
132
145
  },
133
- }
134
- }
135
- pointerEvents="auto"
136
- style={
137
- {
138
- "backgroundColor": "#FFFFFF",
139
- "borderBottomLeftRadius": 0,
140
- "borderBottomRightRadius": 0,
141
- "borderRadius": 16,
142
- "maxHeight": 800,
143
- "opacity": 1,
144
- "position": "absolute",
145
- "transform": [
146
- {
147
- "translateY": 0,
148
- },
149
- {
150
- "scale": 1,
151
- },
152
- ],
153
- "width": "100%",
154
- "zIndex": 3,
155
- }
146
+ ]
156
147
  }
157
148
  >
158
149
  <View