@lookiero/checkout 12.2.0-beta.0 → 12.3.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 (102) hide show
  1. package/dist/src/domain/checkoutItem/model/price.d.ts +1 -1
  2. package/dist/src/infrastructure/delivery/baseBootstrap.d.ts +2 -11
  3. package/dist/src/infrastructure/delivery/baseBootstrap.js +3 -8
  4. package/dist/src/infrastructure/delivery/bootstrap.js +0 -7
  5. package/dist/src/infrastructure/delivery/bootstrap.mock.js +0 -7
  6. package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.js +1 -1
  7. package/dist/src/infrastructure/projection/pricing/pricing.mock.js +1 -1
  8. package/dist/src/infrastructure/tracking/tracking.d.ts +1 -1
  9. package/dist/src/infrastructure/ui/Root.d.ts +1 -2
  10. package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.d.ts +0 -2
  11. package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.js +5 -5
  12. package/dist/src/infrastructure/ui/routing/Routing.d.ts +1 -2
  13. package/dist/src/infrastructure/ui/views/checkout/Checkout.d.ts +1 -2
  14. package/dist/src/infrastructure/ui/views/checkout/Checkout.js +0 -1
  15. package/dist/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.d.ts +1 -2
  16. package/dist/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js +1 -1
  17. package/dist/src/projection/price/price.d.ts +1 -1
  18. package/dist/src/version.d.ts +1 -1
  19. package/dist/src/version.js +1 -1
  20. package/package.json +5 -5
  21. package/src/ExpoRoot.tsx +1 -2
  22. package/src/domain/checkoutItem/model/price.ts +1 -1
  23. package/src/infrastructure/delivery/baseBootstrap.ts +3 -28
  24. package/src/infrastructure/delivery/bootstrap.mock.ts +0 -7
  25. package/src/infrastructure/delivery/bootstrap.ts +0 -7
  26. package/src/infrastructure/projection/checkoutItem/checkoutItem.mock.ts +1 -1
  27. package/src/infrastructure/projection/pricing/pricing.mock.ts +1 -1
  28. package/src/infrastructure/tracking/tracking.ts +1 -1
  29. package/src/infrastructure/tracking/useTrackCheckout.test.tsx +1 -2
  30. package/src/infrastructure/tracking/useTrackCheckout.ts +1 -2
  31. package/src/infrastructure/ui/Root.tsx +1 -2
  32. package/src/infrastructure/ui/components/atoms/price/Price.test.tsx +1 -1
  33. package/src/infrastructure/ui/hooks/useCheckoutFlow.test.tsx +7 -12
  34. package/src/infrastructure/ui/hooks/useCheckoutFlow.tsx +4 -6
  35. package/src/infrastructure/ui/routing/Routing.tsx +1 -2
  36. package/src/infrastructure/ui/views/checkout/Checkout.tsx +1 -3
  37. package/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.tsx +2 -3
  38. package/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.test.tsx +1 -2
  39. package/src/infrastructure/ui/views/return/components/price/Price.test.tsx +1 -1
  40. package/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.test.tsx +1 -2
  41. package/src/projection/price/price.ts +1 -1
  42. package/dist/public/public/assets/adaptive-icon.png +0 -0
  43. package/dist/public/public/assets/favicon.png +0 -0
  44. package/dist/public/public/assets/icon.png +0 -0
  45. package/dist/public/public/assets/splash.png +0 -0
  46. package/dist/public/public/images/not-found.png +0 -0
  47. package/dist/src/domain/checkoutItem/model/currency.d.ts +0 -6
  48. package/dist/src/domain/checkoutItem/model/currency.js +0 -7
  49. package/dist/src/domain/uiSetting/command/updateUiSetting.d.ts +0 -15
  50. package/dist/src/domain/uiSetting/command/updateUiSetting.js +0 -10
  51. package/dist/src/domain/uiSetting/model/uiSetting.d.ts +0 -9
  52. package/dist/src/domain/uiSetting/model/uiSetting.js +0 -11
  53. package/dist/src/domain/uiSetting/model/uiSettingUpdated.d.ts +0 -15
  54. package/dist/src/domain/uiSetting/model/uiSettingUpdated.js +0 -8
  55. package/dist/src/domain/uiSetting/model/uiSettings.d.ts +0 -7
  56. package/dist/src/domain/uiSetting/model/uiSettings.js +0 -1
  57. package/dist/src/infrastructure/domain/uiSetting/model/storageUiSettings.d.ts +0 -17
  58. package/dist/src/infrastructure/domain/uiSetting/model/storageUiSettings.js +0 -20
  59. package/dist/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.d.ts +0 -18
  60. package/dist/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.js +0 -22
  61. package/dist/src/infrastructure/integration/useRedirect.d.ts +0 -7
  62. package/dist/src/infrastructure/integration/useRedirect.js +0 -1
  63. package/dist/src/infrastructure/persistence/asyncStorageStorage.d.ts +0 -5
  64. package/dist/src/infrastructure/persistence/asyncStorageStorage.js +0 -7
  65. package/dist/src/infrastructure/persistence/uiSettingData.d.ts +0 -6
  66. package/dist/src/infrastructure/persistence/uiSettingData.js +0 -1
  67. package/dist/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.d.ts +0 -10
  68. package/dist/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.js +0 -11
  69. package/dist/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.d.ts +0 -13
  70. package/dist/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.js +0 -15
  71. package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.d.ts +0 -27
  72. package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +0 -97
  73. package/dist/src/infrastructure/ui/routing/useBasePath.d.ts +0 -8
  74. package/dist/src/infrastructure/ui/routing/useBasePath.js +0 -9
  75. package/dist/src/infrastructure/ui/settings/UISettings.d.ts +0 -3
  76. package/dist/src/infrastructure/ui/settings/UISettings.js +0 -4
  77. package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.d.ts +0 -12
  78. package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +0 -90
  79. package/dist/src/projection/uiSetting/viewUiSettingByKey.d.ts +0 -29
  80. package/dist/src/projection/uiSetting/viewUiSettingByKey.js +0 -8
  81. package/src/domain/checkoutItem/model/currency.ts +0 -7
  82. package/src/domain/uiSetting/command/updateUiSetting.test.ts +0 -18
  83. package/src/domain/uiSetting/command/updateUiSetting.ts +0 -26
  84. package/src/domain/uiSetting/model/uiSetting.test.ts +0 -25
  85. package/src/domain/uiSetting/model/uiSetting.ts +0 -24
  86. package/src/domain/uiSetting/model/uiSettingUpdated.test.ts +0 -16
  87. package/src/domain/uiSetting/model/uiSettingUpdated.ts +0 -25
  88. package/src/domain/uiSetting/model/uiSettings.ts +0 -15
  89. package/src/infrastructure/domain/uiSetting/model/storageUiSettings.test.ts +0 -50
  90. package/src/infrastructure/domain/uiSetting/model/storageUiSettings.ts +0 -49
  91. package/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.test.ts +0 -62
  92. package/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.ts +0 -50
  93. package/src/infrastructure/integration/useRedirect.ts +0 -9
  94. package/src/infrastructure/persistence/asyncStorageStorage.ts +0 -13
  95. package/src/infrastructure/persistence/uiSettingData.ts +0 -7
  96. package/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.test.ts +0 -33
  97. package/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.ts +0 -22
  98. package/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.test.ts +0 -36
  99. package/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.ts +0 -37
  100. package/src/infrastructure/ui/settings/UISettings.ts +0 -3
  101. package/src/projection/uiSetting/viewUiSettingByKey.test.ts +0 -23
  102. package/src/projection/uiSetting/viewUiSettingByKey.ts +0 -50
@@ -1,11 +1,10 @@
1
1
  import { useCallback } from "react";
2
2
  import invariant from "tiny-invariant";
3
- import { Country } from "@lookiero/sty-psp-locale";
3
+ import { Country, Currency } from "@lookiero/sty-psp-locale";
4
4
  import { Segment } from "@lookiero/sty-psp-segment";
5
5
  import { useEmitUserEvent } from "@lookiero/sty-psp-tracking";
6
6
  import { Tradename } from "@lookiero/sty-sp-tradename";
7
7
  import { CheckoutItemStatus } from "../../domain/checkoutItem/model/checkoutItem";
8
- import { Currency } from "../../domain/checkoutItem/model/currency";
9
8
  import { CheckoutProjection } from "../../projection/checkout/checkout";
10
9
  import { OrderProjection } from "../../projection/order/order";
11
10
  import { PricingProjection } from "../../projection/pricing/pricing";
@@ -13,7 +13,6 @@ import { Customer } from "../../projection/customer/customer";
13
13
  import { OrderProjection } from "../../projection/order/order";
14
14
  import { SubscriptionProjection } from "../../projection/subscription/subscription";
15
15
  import { KameleoonEnvironment } from "../ab-testing/kameleoonEnvironment";
16
- import { UseRedirectFunction } from "../integration/useRedirect";
17
16
  import { QueryBusProvider } from "./hooks/useQueryBus";
18
17
  import { Routing } from "./routing/Routing";
19
18
 
@@ -41,7 +40,7 @@ interface RootProps {
41
40
  readonly tradename: Tradename;
42
41
  readonly onNotAccessible: () => void;
43
42
  readonly onCheckoutFlowSuccess: () => void;
44
- readonly useRedirect: UseRedirectFunction;
43
+ readonly useRedirect: () => Record<string, string>;
45
44
  readonly useRoutes?: typeof reactRouterUseRoutes;
46
45
  }
47
46
 
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { Currency } from "../../../../../domain/checkoutItem/model/currency";
2
+ import { Currency } from "@lookiero/sty-psp-locale";
3
3
  import { PriceProjection } from "../../../../../projection/price/price";
4
4
  import { render } from "../../../test/render";
5
5
  import { Price } from "./Price";
@@ -11,7 +11,6 @@ import { OrderProjection } from "../../../projection/order/order";
11
11
  import { SubscriptionProjection } from "../../../projection/subscription/subscription";
12
12
  import { useSubmitCheckout } from "../../domain/checkout/react/useSubmitCheckout";
13
13
  import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
14
- import { UseRedirectFunction } from "../../integration/useRedirect";
15
14
  import { checkout } from "../../projection/checkout/checkout.mock";
16
15
  import { useViewIsSizeChangeEnabledByCheckoutId } from "../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
17
16
  import { paymentFlowPayload as mockPaymentFlowPayload } from "../../projection/payment/paymentFlowPayload.mock";
@@ -19,15 +18,11 @@ import { useViewPaymentFlowPayloadByCheckoutId } from "../../projection/payment/
19
18
  import { pricing } from "../../projection/pricing/pricing.mock";
20
19
  import { useViewPricingByCheckoutId } from "../../projection/pricing/react/useViewPricingByCheckoutId";
21
20
  import { I18nMessages } from "../i18n/i18n";
21
+ import { Routes } from "../routing/routes";
22
22
  import { useCheckoutFlow as sut } from "./useCheckoutFlow";
23
23
  import { usePaymentInstrumentEvents } from "./usePaymentInstrumentEvents";
24
24
  import { useQueryBus } from "./useQueryBus";
25
25
 
26
- const returnUrl = "/checkout";
27
- const useRedirect: UseRedirectFunction = () => ({
28
- returnUrl,
29
- });
30
-
31
26
  const getAuthToken = () => Promise.resolve("token");
32
27
  const mockCheckout = checkout({
33
28
  items: [
@@ -124,7 +119,7 @@ describe("useCheckoutFlow custom hook", () => {
124
119
  });
125
120
 
126
121
  const { result } = renderHook(() =>
127
- sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess, useRedirect }),
122
+ sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
128
123
  );
129
124
 
130
125
  let checkoutFlow: () => void, status, paymentFlowComponent;
@@ -150,7 +145,7 @@ describe("useCheckoutFlow custom hook", () => {
150
145
  expect.objectContaining({
151
146
  ...mockPaymentFlowPayload,
152
147
  userInformation: { email, name },
153
- returnUrl,
148
+ returnUrl: `${basePath}/${Routes.CHECKOUT}`,
154
149
  }),
155
150
  );
156
151
  expect(mockSubmitCheckout).toHaveBeenCalled();
@@ -180,7 +175,7 @@ describe("useCheckoutFlow custom hook", () => {
180
175
  });
181
176
 
182
177
  const { result } = renderHook(() =>
183
- sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess, useRedirect }),
178
+ sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
184
179
  );
185
180
 
186
181
  let checkoutFlow: () => void, status, paymentFlowComponent;
@@ -206,7 +201,7 @@ describe("useCheckoutFlow custom hook", () => {
206
201
  expect.objectContaining({
207
202
  ...mockPaymentFlowPayload,
208
203
  userInformation: { email, name },
209
- returnUrl,
204
+ returnUrl: `${basePath}/${Routes.CHECKOUT}`,
210
205
  }),
211
206
  );
212
207
  expect(mockSubmitCheckout).toHaveBeenCalled();
@@ -236,7 +231,7 @@ describe("useCheckoutFlow custom hook", () => {
236
231
  });
237
232
 
238
233
  const { result } = renderHook(() =>
239
- sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess, useRedirect }),
234
+ sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
240
235
  );
241
236
 
242
237
  let checkoutFlow: () => void, status, paymentFlowComponent;
@@ -283,7 +278,7 @@ describe("useCheckoutFlow custom hook", () => {
283
278
  });
284
279
 
285
280
  const { result } = renderHook(() =>
286
- sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess, useRedirect }),
281
+ sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
287
282
  );
288
283
 
289
284
  let checkoutFlow: () => void, status, paymentFlowComponent;
@@ -15,12 +15,12 @@ import { SubscriptionProjection } from "../../../projection/subscription/subscri
15
15
  import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
16
16
  import { useSubmitCheckout } from "../../domain/checkout/react/useSubmitCheckout";
17
17
  import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
18
- import { UseRedirectFunction } from "../../integration/useRedirect";
19
18
  import { useViewIsSizeChangeEnabledByCheckoutId } from "../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
20
19
  import { useViewPaymentFlowPayloadByCheckoutId } from "../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId";
21
20
  import { useViewPricingByCheckoutId } from "../../projection/pricing/react/useViewPricingByCheckoutId";
22
21
  import { useTrackCheckout } from "../../tracking/useTrackCheckout";
23
22
  import { I18nMessages } from "../i18n/i18n";
23
+ import { Routes } from "../routing/routes";
24
24
  import { usePaymentInstrumentEvents } from "./usePaymentInstrumentEvents";
25
25
  import { useQueryBus } from "./useQueryBus";
26
26
  import { useStaticInfo } from "./useStaticInfo";
@@ -43,7 +43,6 @@ interface UseCheckoutFlowArgs {
43
43
  readonly subscription: SubscriptionProjection;
44
44
  readonly getAuthToken: () => Promise<string>;
45
45
  readonly onSuccess: () => void;
46
- readonly useRedirect: UseRedirectFunction;
47
46
  }
48
47
 
49
48
  interface UseCheckoutFlowFunction {
@@ -56,15 +55,14 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
56
55
  subscription: subscriptionProjection,
57
56
  getAuthToken,
58
57
  onSuccess,
59
- useRedirect,
60
58
  }) => {
61
59
  const logger = useLogger();
62
60
  const queryBus = useQueryBus();
63
61
  const {
64
62
  customer: { customerId, country, segment, name, email },
63
+ basePath,
65
64
  tradename,
66
65
  } = useStaticInfo();
67
- const { returnUrl } = useRedirect();
68
66
  const paymentFlowRef = useRef<PaymentFlowRef>(null);
69
67
  const [paymentFlowPayload] = useViewPaymentFlowPayloadByCheckoutId({
70
68
  checkoutId: checkoutProjection?.id as string,
@@ -124,14 +122,14 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
124
122
  paymentFlowRef.current?.startLegacyBoxCheckout({
125
123
  ...paymentFlowPayload,
126
124
  userInformation: { email, name },
127
- returnUrl,
125
+ returnUrl: `${basePath}/${Routes.CHECKOUT}`,
128
126
  } as unknown as LegacyBoxCheckoutStrategyPayload);
129
127
  }, [
130
128
  checkoutProjection?.checkoutBookingId,
131
129
  paymentFlowPayload,
132
130
  email,
133
131
  name,
134
- returnUrl,
132
+ basePath,
135
133
  sizeChangeEnabled,
136
134
  blockCheckoutBooking,
137
135
  queryBus,
@@ -10,7 +10,6 @@ import { Customer } from "../../../projection/customer/customer";
10
10
  import { OrderProjection } from "../../../projection/order/order";
11
11
  import { SubscriptionProjection } from "../../../projection/subscription/subscription";
12
12
  import { KameleoonEnvironment } from "../../ab-testing/kameleoonEnvironment";
13
- import { UseRedirectFunction } from "../../integration/useRedirect";
14
13
  import { StaticInfoProvider } from "../hooks/useStaticInfo";
15
14
  import { App } from "../views/App";
16
15
  import { Checkout } from "../views/checkout/Checkout";
@@ -36,7 +35,7 @@ interface RoutingProps {
36
35
  readonly onNotAccessible: () => void;
37
36
  readonly onCheckoutFlowSuccess: () => void;
38
37
  readonly onI18nError?: (err: Error) => void;
39
- readonly useRedirect: UseRedirectFunction;
38
+ readonly useRedirect: () => Record<string, string>;
40
39
  readonly useRoutes: typeof reactRouterUseRoutes;
41
40
  }
42
41
 
@@ -9,7 +9,6 @@ import { Layout as UiLayout, Sticky, useScreenSize } from "@lookiero/sty-psp-ui"
9
9
  import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
10
10
  import { OrderProjection } from "../../../../projection/order/order";
11
11
  import { SubscriptionProjection } from "../../../../projection/subscription/subscription";
12
- import { UseRedirectFunction } from "../../../integration/useRedirect";
13
12
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
14
13
  import { useViewPricingByCheckoutId } from "../../../projection/pricing/react/useViewPricingByCheckoutId";
15
14
  import { TrackingPage } from "../../../tracking/tracking";
@@ -34,7 +33,7 @@ interface CheckoutProps {
34
33
  readonly subscription: SubscriptionProjection;
35
34
  readonly getAuthToken: () => Promise<string>;
36
35
  readonly onCheckoutFlowSuccess: () => void;
37
- readonly useRedirect: UseRedirectFunction;
36
+ readonly useRedirect: () => Record<string, string>;
38
37
  }
39
38
 
40
39
  const Checkout: FC<CheckoutProps> = ({
@@ -69,7 +68,6 @@ const Checkout: FC<CheckoutProps> = ({
69
68
  subscription,
70
69
  getAuthToken,
71
70
  onSuccess: onCheckoutFlowSuccess,
72
- useRedirect,
73
71
  });
74
72
 
75
73
  useTrackPageView({
@@ -1,10 +1,9 @@
1
1
  import React, { FC } from "react";
2
2
  import { PaymentInstrumentSelect, Section } from "@lookiero/payments-front";
3
- import { UseRedirectFunction } from "../../../../../integration/useRedirect";
4
3
  import { useStaticInfo } from "../../../../hooks/useStaticInfo";
5
4
 
6
5
  interface PaymentInstrumentProps {
7
- readonly useRedirect: UseRedirectFunction;
6
+ readonly useRedirect: () => Record<string, string>;
8
7
  }
9
8
  const PaymentInstrument: FC<PaymentInstrumentProps> = ({ useRedirect }) => {
10
9
  const { returnUrl } = useRedirect();
@@ -12,7 +11,7 @@ const PaymentInstrument: FC<PaymentInstrumentProps> = ({ useRedirect }) => {
12
11
 
13
12
  return (
14
13
  <PaymentInstrumentSelect
15
- beforeRedirect={() => Promise.resolve(returnUrl)}
14
+ beforeRedirect={returnUrl ? () => Promise.resolve(returnUrl) : undefined}
16
15
  hasError={false}
17
16
  section={Section.BOX_CHECKOUT}
18
17
  userInformation={{
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
- import { Country } from "@lookiero/sty-psp-locale";
3
- import { Currency } from "../../../../../../domain/checkoutItem/model/currency";
2
+ import { Country, Currency } from "@lookiero/sty-psp-locale";
4
3
  import { I18nMessages } from "../../../../i18n/i18n";
5
4
  import { render } from "../../../../test/render";
6
5
  import { ProductVariantDescription } from "./ProductVariantDescription";
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { Currency } from "../../../../../../domain/checkoutItem/model/currency";
2
+ import { Currency } from "@lookiero/sty-psp-locale";
3
3
  import { PriceProjection } from "../../../../../../projection/price/price";
4
4
  import { render } from "../../../../test/render";
5
5
  import { Price } from "./Price";
@@ -1,8 +1,7 @@
1
1
  import { fireEvent } from "@testing-library/react-native";
2
2
  import React from "react";
3
- import { Country } from "@lookiero/sty-psp-locale";
3
+ import { Country, Currency } from "@lookiero/sty-psp-locale";
4
4
  import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
5
- import { Currency } from "../../../../../../domain/checkoutItem/model/currency";
6
5
  import { ColorProjection, MediaPerspective } from "../../../../../../projection/checkoutItem/checkoutItem";
7
6
  import { COLOR_I18N_PREFIX, I18nMessages } from "../../../../i18n/i18n";
8
7
  import { render } from "../../../../test/render";
@@ -1,4 +1,4 @@
1
- import { Currency } from "../../domain/checkoutItem/model/currency";
1
+ import { Currency } from "@lookiero/sty-psp-locale";
2
2
 
3
3
  interface PriceProjection {
4
4
  readonly amount: number;
Binary file
@@ -1,6 +0,0 @@
1
- declare enum Currency {
2
- EUR = "EUR",
3
- GBP = "GBP",
4
- SEK = "SEK"
5
- }
6
- export { Currency };
@@ -1,7 +0,0 @@
1
- var Currency;
2
- (function (Currency) {
3
- Currency["EUR"] = "EUR";
4
- Currency["GBP"] = "GBP";
5
- Currency["SEK"] = "SEK";
6
- })(Currency || (Currency = {}));
7
- export { Currency };
@@ -1,15 +0,0 @@
1
- import { Command } from "@lookiero/messaging";
2
- declare const UPDATE_UI_SETTING = "update_ui_setting";
3
- interface UpdateUiSettingPayload {
4
- readonly aggregateId: string;
5
- readonly key: string;
6
- readonly value: unknown;
7
- }
8
- interface UpdateUiSetting extends Command<typeof UPDATE_UI_SETTING>, UpdateUiSettingPayload {
9
- }
10
- interface UpdateUiSettingFunction {
11
- (payload: UpdateUiSettingPayload): UpdateUiSetting;
12
- }
13
- declare const updateUiSetting: UpdateUiSettingFunction;
14
- export type { UpdateUiSetting };
15
- export { UPDATE_UI_SETTING, updateUiSetting };
@@ -1,10 +0,0 @@
1
- import { command } from "@lookiero/messaging";
2
- const UPDATE_UI_SETTING = "update_ui_setting";
3
- const updateUiSetting = ({ aggregateId, ...payload }) => ({
4
- ...command({
5
- aggregateId,
6
- name: UPDATE_UI_SETTING,
7
- }),
8
- ...payload,
9
- });
10
- export { UPDATE_UI_SETTING, updateUiSetting };
@@ -1,9 +0,0 @@
1
- import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
2
- import { UpdateUiSetting } from "../command/updateUiSetting";
3
- interface UiSetting extends AggregateRoot {
4
- readonly key: string;
5
- readonly value: unknown;
6
- }
7
- declare const updateUiSettingHandler: CommandHandlerFunction<UpdateUiSetting, UiSetting>;
8
- export type { UiSetting };
9
- export { updateUiSettingHandler };
@@ -1,11 +0,0 @@
1
- import { uiSettingUpdated } from "./uiSettingUpdated";
2
- const updateUiSettingHandler = () => async ({ aggregateRoot, command }) => {
3
- const { aggregateId, key, value } = command;
4
- return {
5
- ...aggregateRoot,
6
- key,
7
- value,
8
- domainEvents: [uiSettingUpdated({ aggregateId, key })],
9
- };
10
- };
11
- export { updateUiSettingHandler };
@@ -1,15 +0,0 @@
1
- import { DomainEvent, MessageName } from "@lookiero/messaging";
2
- declare const UI_SETTING_UPDATED = "ui_setting_updated";
3
- interface UiSettingUpdatedPayload {
4
- readonly aggregateId: string;
5
- readonly key: string;
6
- }
7
- interface UiSettingUpdated extends DomainEvent<typeof UI_SETTING_UPDATED>, UiSettingUpdatedPayload {
8
- }
9
- interface UiSettingUpdatedFunction {
10
- (payload: UiSettingUpdatedPayload): UiSettingUpdated;
11
- }
12
- declare const uiSettingUpdated: UiSettingUpdatedFunction;
13
- declare const isUiSettingUpdated: (event: DomainEvent<MessageName>) => event is UiSettingUpdated;
14
- export type { UiSettingUpdated };
15
- export { UI_SETTING_UPDATED, uiSettingUpdated, isUiSettingUpdated };
@@ -1,8 +0,0 @@
1
- import { domainEvent } from "@lookiero/messaging";
2
- const UI_SETTING_UPDATED = "ui_setting_updated";
3
- const uiSettingUpdated = ({ aggregateId, key }) => ({
4
- ...domainEvent({ aggregateId, name: UI_SETTING_UPDATED }),
5
- key,
6
- });
7
- const isUiSettingUpdated = (event) => event.name === UI_SETTING_UPDATED;
8
- export { UI_SETTING_UPDATED, uiSettingUpdated, isUiSettingUpdated };
@@ -1,7 +0,0 @@
1
- import { RepositoryGetFunction, RepositoryGetFunctionArgs, RepositorySaveFunction, RepositorySaveFunctionArgs } from "@lookiero/messaging";
2
- import { UiSetting } from "./uiSetting";
3
- interface UiSettingGetFunction<UiSettingGetFunctionArgs extends RepositoryGetFunctionArgs> extends RepositoryGetFunction<UiSetting, UiSettingGetFunctionArgs> {
4
- }
5
- interface UiSettingSaveFunction<UiSettingSaveFunctionArgs extends RepositorySaveFunctionArgs> extends RepositorySaveFunction<UiSetting, UiSettingSaveFunctionArgs> {
6
- }
7
- export type { UiSettingGetFunction, UiSettingSaveFunction };
@@ -1 +0,0 @@
1
- export {};
@@ -1,17 +0,0 @@
1
- import { RepositoryGetFunctionArgs, RepositorySaveFunctionArgs } from "@lookiero/messaging";
2
- import { UiSettingGetFunction, UiSettingSaveFunction } from "../../../../domain/uiSetting/model/uiSettings";
3
- import { ReadFunction, WriteFunction } from "../../../persistence/storage";
4
- import { UiSettingDto } from "../../../persistence/uiSettingData";
5
- interface StorageUiSettingsGetFunctionArgs extends RepositoryGetFunctionArgs {
6
- readonly read: ReadFunction<UiSettingDto>;
7
- }
8
- interface StorageUiSettingsGetFunction extends UiSettingGetFunction<StorageUiSettingsGetFunctionArgs> {
9
- }
10
- declare const getUiSetting: StorageUiSettingsGetFunction;
11
- interface StorageUiSettingsSaveFunctionArgs extends RepositorySaveFunctionArgs {
12
- readonly write: WriteFunction<UiSettingDto>;
13
- }
14
- interface StorageUiSettingsSaveFunction extends UiSettingSaveFunction<StorageUiSettingsSaveFunctionArgs> {
15
- }
16
- declare const saveUiSetting: StorageUiSettingsSaveFunction;
17
- export { getUiSetting, saveUiSetting };
@@ -1,20 +0,0 @@
1
- const toDomain = (uiSettingDto) => ({
2
- aggregateId: uiSettingDto.id,
3
- key: uiSettingDto.key,
4
- value: uiSettingDto.value,
5
- domainEvents: [],
6
- });
7
- const fromDomain = (uiSetting) => ({
8
- id: uiSetting.aggregateId,
9
- key: uiSetting.key,
10
- value: uiSetting.value,
11
- });
12
- const getUiSetting = ({ read }) => async (uiSettingKey) => {
13
- const uiSettingDto = await read(uiSettingKey);
14
- if (!uiSettingDto) {
15
- throw new Error(`UiSetting not found: ${uiSettingKey}`);
16
- }
17
- return toDomain(uiSettingDto);
18
- };
19
- const saveUiSetting = ({ write }) => async (aggregateRoot) => await write(aggregateRoot.key, fromDomain(aggregateRoot));
20
- export { getUiSetting, saveUiSetting };
@@ -1,18 +0,0 @@
1
- import { CommandStatus } from "@lookiero/messaging-react";
2
- import { Logger } from "@lookiero/sty-psp-logging";
3
- interface UpdateFunctionArgs {
4
- readonly key: string;
5
- readonly value: unknown;
6
- }
7
- interface UpdateFunction {
8
- (args: UpdateFunctionArgs): Promise<void>;
9
- }
10
- type UseUpdateUiSetting = [update: UpdateFunction, status: CommandStatus];
11
- interface UseUpdateUiSettingArgs {
12
- readonly logger: Logger;
13
- }
14
- interface UseUpdateUiSettingFunction {
15
- (args: UseUpdateUiSettingArgs): UseUpdateUiSetting;
16
- }
17
- declare const useUpdateUiSetting: UseUpdateUiSettingFunction;
18
- export { useUpdateUiSetting };
@@ -1,22 +0,0 @@
1
- import { useCallback } from "react";
2
- import { v4 as uuid } from "uuid";
3
- import { useCommand } from "@lookiero/messaging-react";
4
- import { updateUiSetting } from "../../../../domain/uiSetting/command/updateUiSetting";
5
- import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
6
- const useUpdateUiSetting = ({ logger }) => {
7
- const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
8
- const update = useCallback(async ({ key, value }) => {
9
- try {
10
- await commandBus(updateUiSetting({
11
- aggregateId: uuid(),
12
- key,
13
- value,
14
- }));
15
- }
16
- catch (error) {
17
- logger.captureException(error);
18
- }
19
- }, [commandBus, logger]);
20
- return [update, status];
21
- };
22
- export { useUpdateUiSetting };
@@ -1,7 +0,0 @@
1
- interface UseRedirectFunctionReturn {
2
- readonly returnUrl: string;
3
- }
4
- interface UseRedirectFunction {
5
- (): UseRedirectFunctionReturn;
6
- }
7
- export type { UseRedirectFunction };
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- import { ReadFunction, WriteFunction } from "./storage";
2
- import { UiSettingDto } from "./uiSettingData";
3
- declare const read: ReadFunction<UiSettingDto>;
4
- declare const write: WriteFunction<UiSettingDto>;
5
- export { read, write };
@@ -1,7 +0,0 @@
1
- import AsyncStorage from "@react-native-async-storage/async-storage";
2
- const read = async (key) => {
3
- const value = await AsyncStorage.getItem(key);
4
- return value ? JSON.parse(value) : null;
5
- };
6
- const write = async (key, value) => AsyncStorage.setItem(key, JSON.stringify(value));
7
- export { read, write };
@@ -1,6 +0,0 @@
1
- interface UiSettingDto {
2
- readonly id: string;
3
- readonly key: string;
4
- readonly value: unknown;
5
- }
6
- export type { UiSettingDto };
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- import { UseQueryFunctionResult } from "@lookiero/messaging-react";
2
- import { UiSettingProjection } from "../../../../projection/uiSetting/viewUiSettingByKey";
3
- interface UseViewUiSettingByKeyFunctionArgs {
4
- readonly key: string;
5
- }
6
- interface UseViewUiSettingByKeyFunction {
7
- (args: UseViewUiSettingByKeyFunctionArgs): UseQueryFunctionResult<UiSettingProjection>;
8
- }
9
- declare const useViewUiSettingByKey: UseViewUiSettingByKeyFunction;
10
- export { useViewUiSettingByKey };
@@ -1,11 +0,0 @@
1
- import { useQuery } from "@lookiero/messaging-react";
2
- import { isUiSettingUpdated } from "../../../../domain/uiSetting/model/uiSettingUpdated";
3
- import { viewUiSettingByKey } from "../../../../projection/uiSetting/viewUiSettingByKey";
4
- import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
5
- const useViewUiSettingByKey = ({ key }) => useQuery({
6
- query: viewUiSettingByKey({ key }),
7
- contextId: MESSAGING_CONTEXT_ID,
8
- invalidation: isUiSettingUpdated,
9
- options: { refetchOnMount: "always", staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
10
- });
11
- export { useViewUiSettingByKey };
@@ -1,13 +0,0 @@
1
- import { UiSettingByKeyView } from "../../../projection/uiSetting/viewUiSettingByKey";
2
- import { ReadFunction } from "../../persistence/storage";
3
- import { UiSettingDto } from "../../persistence/uiSettingData";
4
- interface StorageUiSettingByKeyView extends UiSettingByKeyView {
5
- }
6
- interface StorageUiSettingByKeyViewFunctionArgs {
7
- readonly read: ReadFunction<UiSettingDto>;
8
- }
9
- interface StorageUiSettingByKeyViewFunction {
10
- (args: StorageUiSettingByKeyViewFunctionArgs): StorageUiSettingByKeyView;
11
- }
12
- declare const storageUiSettingByKeyView: StorageUiSettingByKeyViewFunction;
13
- export { storageUiSettingByKeyView };
@@ -1,15 +0,0 @@
1
- const toUiSettingProjection = (uiSettingDto) => ({
2
- id: uiSettingDto.id,
3
- key: uiSettingDto.key,
4
- value: uiSettingDto.value,
5
- });
6
- const storageUiSettingByKeyView = ({ read }) => async ({ key }) => {
7
- try {
8
- const uiSettingDto = await read(key);
9
- return uiSettingDto ? toUiSettingProjection(uiSettingDto) : null;
10
- }
11
- catch (ignored) {
12
- throw new Error("Could not fetch the uiSetting");
13
- }
14
- };
15
- export { storageUiSettingByKeyView };
@@ -1,27 +0,0 @@
1
- import { RefObject } from "react";
2
- import { PaymentFlowRef } from "@lookiero/payments-front";
3
- import { Logger } from "@lookiero/sty-psp-logging";
4
- import { PaymentFlowPayloadProjection } from "../../../projection/payment/paymentFlowPayload";
5
- type Status = "idle" | "loading" | "success" | "error";
6
- interface SubmitCheckoutFunctionArgs {
7
- readonly paymentFlowPayload: PaymentFlowPayloadProjection;
8
- readonly sizeChangeEnabled: boolean;
9
- }
10
- interface SubmitCheckoutFunction {
11
- (args: SubmitCheckoutFunctionArgs): Promise<void>;
12
- }
13
- type UseSubmitCheckoutResult = [submitCheckout: SubmitCheckoutFunction, status: Status];
14
- interface UseSubmitCheckoutFunctionArgs {
15
- readonly checkoutId: string;
16
- readonly checkoutBookingId: string;
17
- readonly paymentFlowRef: RefObject<PaymentFlowRef>;
18
- readonly onError: () => void;
19
- readonly onSuccess?: () => void;
20
- readonly logger: Logger;
21
- }
22
- interface UseSubmitCheckoutFunction {
23
- (args: UseSubmitCheckoutFunctionArgs): UseSubmitCheckoutResult;
24
- }
25
- declare const useSubmitCheckout: UseSubmitCheckoutFunction;
26
- export type { Status, SubmitCheckoutFunction };
27
- export { useSubmitCheckout };