@lookiero/checkout 12.23.0 → 12.24.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.
@@ -16,7 +16,9 @@ interface UsePaymentStatusManagerResult {
16
16
  }
17
17
  declare const usePaymentStatusManager: (section: Section) => UsePaymentStatusManagerResult;
18
18
  declare enum Section {
19
- BOX_CHECKOUT = "box-checkout"
19
+ BOX_CHECKOUT = "box-checkout",
20
+ DIRECT_BUY_CHECKOUT = "direct-buy-checkout"
20
21
  }
22
+ declare const PayButton: FC;
21
23
  export type { PaymentFlowRef };
22
- export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, usePaymentStatusManager, };
24
+ export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, usePaymentStatusManager, PayButton, };
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/naming-convention */
2
- import { forwardRef, useImperativeHandle, } from "react";
2
+ import React, { forwardRef, useImperativeHandle, } from "react";
3
+ import { Button } from "@lookiero/aurora";
3
4
  let startLegacyBoxCheckoutListener;
4
5
  const setPaymentsBridge = () => void 0;
5
6
  const PaymentsQueryProvider = ({ children }) => children;
@@ -24,5 +25,7 @@ const usePaymentStatusManager = () => paymentStatusManagerResult;
24
25
  var Section;
25
26
  (function (Section) {
26
27
  Section["BOX_CHECKOUT"] = "box-checkout";
28
+ Section["DIRECT_BUY_CHECKOUT"] = "direct-buy-checkout";
27
29
  })(Section || (Section = {}));
28
- export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, usePaymentStatusManager, };
30
+ const PayButton = ({ ...props }) => React.createElement(Button, { ...props }, "Pay");
31
+ export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, usePaymentStatusManager, PayButton, };
@@ -18,7 +18,7 @@ import { root } from "./infrastructure/ui/Root";
18
18
  import { DOMAIN } from "./infrastructure/ui/i18n/i18n";
19
19
  import { Router } from "./infrastructure/ui/routing/router/Router";
20
20
  import { VERSION } from "./version";
21
- const tradename = Tradename.LOOKIERO;
21
+ const tradename = Tradename.OUTFITTERY;
22
22
  const theme = themeByTradename({ tradename });
23
23
  const locale = Locale.es_ES;
24
24
  const subscription = "b";
@@ -28,7 +28,7 @@ const order = {
28
28
  coupon: "MYLOOKIERO",
29
29
  };
30
30
  const customer = {
31
- customerId: "6bf2156d-aa5f-432a-88c9-578e9b6992fa",
31
+ customerId: "f943ae75-bffb-4b14-b418-e8c79da41dde",
32
32
  country: Country.ES,
33
33
  segment: Segment.WOMEN,
34
34
  email: "email@example.com",
@@ -47,7 +47,7 @@ const apiUrl = Platform.OS !== "web"
47
47
  ? "/local-to-dev"
48
48
  : "http://localhost:3004/local-to-dev"
49
49
  : "/checkout/api";
50
- const authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEzMTA4NTY4LCJleHAiOjE3NjAyNjEzNDIsImRpc3BsYXlOYW1lIjoiTWlrZWwiLCJjb3VudHJ5X2NvZGUiOiJFUyIsImFjY2Vzc1ZpYSI6ImVtYWlsIiwic3Vic2NyaXB0aW9uU3RhcnRpbmdEYXRlIjoiMjAyNS0wOS0xMSIsImltcGVyc29uYXRlZCI6ZmFsc2UsInV1aWQiOiJhYjIzN2FiMy1mOWY2LTRiNWItOTNjMi1lNjg3YzJmOTlkMmMiLCJ0cmFkZW5hbWUiOiJMT09LSUVSTyIsImlhdCI6MTc1NzY2OTM0Mn0.mw9E6PLIc0KeXe7AdDcxxJrZZuGATxVoht5jDOlDXrk";
50
+ const authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEzNDQzMjA4LCJleHAiOjE3NjQzNDQwNjUsImRpc3BsYXlOYW1lIjoiQWxleGFuZGVyIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjUtMTAtMjciLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiZjk0M2FlNzUtYmZmYi00YjE0LWI0MTgtZThjNzlkYTQxZGRlIiwidHJhZGVuYW1lIjoiT1VURklUVEVSWSIsImlhdCI6MTc2MTY2NTY2NX0.ACQlI_HmEytLQCWNLXPStOwNdrOKjU9IHW4ezrHoquc";
51
51
  const getAuthToken = () => Promise.resolve(authToken);
52
52
  const externalTranslationsUrl = Platform.OS !== "web"
53
53
  ? "https://backend-for-user.dev.envs.lookiero.tech/api/v2/translations"
@@ -86,9 +86,10 @@ setPaymentsBridge({
86
86
  appVersion: VERSION,
87
87
  graphqlUri: "/graphql",
88
88
  useFeatureFlags: () => ({}),
89
- locale: () => Promise.resolve("es-ES"),
89
+ locale: () => "es-ES",
90
90
  scrollView: ScrollView,
91
91
  hostUrl: "",
92
+ tradename,
92
93
  });
93
94
  const kameleoonConfig = {
94
95
  siteCode: "aplm4v3ckn",
@@ -45,7 +45,6 @@ declare enum I18nMessages {
45
45
  SUMMARY_FEE = "summary.fee",
46
46
  PRODUCT_VARIANT_SIZE_CHANGE = "product_variant.size_change",
47
47
  CHECKOUT_TITLE = "checkout.title",
48
- CHECKOUT_PAY_BUTTON = "checkout.pay_button",
49
48
  CHECKOUT_TOAST_PAYMENT_ERROR = "checkout.toast_payment_error",
50
49
  CHECKOUT_TOAST_PAYMENT_SUCCESS = "checkout.toast_payment_success",
51
50
  CHECKOUT_SUCCESS_MODAL_TITLE = "checkout.success_modal_title",
@@ -47,7 +47,6 @@ var I18nMessages;
47
47
  I18nMessages["SUMMARY_FEE"] = "summary.fee";
48
48
  I18nMessages["PRODUCT_VARIANT_SIZE_CHANGE"] = "product_variant.size_change";
49
49
  I18nMessages["CHECKOUT_TITLE"] = "checkout.title";
50
- I18nMessages["CHECKOUT_PAY_BUTTON"] = "checkout.pay_button";
51
50
  I18nMessages["CHECKOUT_TOAST_PAYMENT_ERROR"] = "checkout.toast_payment_error";
52
51
  I18nMessages["CHECKOUT_TOAST_PAYMENT_SUCCESS"] = "checkout.toast_payment_success";
53
52
  I18nMessages["CHECKOUT_SUCCESS_MODAL_TITLE"] = "checkout.success_modal_title";
@@ -1,9 +1,10 @@
1
1
  import React, { useCallback, useMemo, useState } from "react";
2
2
  import { Platform, ScrollView, View } from "react-native";
3
3
  import { useNavigate } from "react-router-native";
4
- import { Box, Button, Layout as AuroraLayout, Spinner, Text } from "@lookiero/aurora";
4
+ import { Box, Layout as AuroraLayout, Spinner, Text } from "@lookiero/aurora";
5
5
  import { useI18nMessage } from "@lookiero/i18n-react";
6
6
  import { QueryStatus } from "@lookiero/messaging-react";
7
+ import { PayButton, Section } from "@lookiero/payments-front";
7
8
  import { Country } from "@lookiero/sty-psp-locale";
8
9
  import { Sticky, useScreenSize } from "@lookiero/sty-psp-ui";
9
10
  import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
@@ -30,7 +31,6 @@ const Checkout = ({ layout: Layout, order, subscription, getAuthToken, useRedire
30
31
  const isDektopScreen = screenSize === "L";
31
32
  const style = useMemo(() => checkoutStyle(), []);
32
33
  const titleText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.CHECKOUT_TITLE });
33
- const submitButtonText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.CHECKOUT_PAY_BUTTON });
34
34
  const [pricingHeight, setPricingHeight] = useState(0);
35
35
  const handleOnPricingLayout = useCallback(({ height }) => setPricingHeight(height), []);
36
36
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
@@ -74,6 +74,7 @@ const Checkout = ({ layout: Layout, order, subscription, getAuthToken, useRedire
74
74
  trackPressBack();
75
75
  navigate(`${basePath}/${Routes.SUMMARY}`);
76
76
  }, [basePath, navigate, trackPressBack]);
77
+ const PaymentButton = () => useMemo(() => (React.createElement(PayButton, { busy: checkoutFlowStatus === "loading", section: Section.BOX_CHECKOUT, testID: "confirm-checkout-button", small: true, onPress: handleOnSubmit })), []);
77
78
  const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
78
79
  const dependenciesLoaded = (dependenciesLoadedStatuses.includes(checkoutStatus) || checkout) &&
79
80
  dependenciesLoadedStatuses.includes(pricingStatus);
@@ -100,10 +101,10 @@ const Checkout = ({ layout: Layout, order, subscription, getAuthToken, useRedire
100
101
  React.createElement(PaymentInstrument, { useRedirect: useRedirect }))))),
101
102
  React.createElement(Box, { size: { L: "1/3" }, style: [style.resume, isDektopScreen && style.desktopResume] }, pricing ? (React.createElement(View, { style: [style.princingWrapper, !isDektopScreen && style.princingWrapperSmall] },
102
103
  React.createElement(Pricing, { pricing: pricing, totalCheckoutItemsKept: checkoutItemsKept?.length || 0 }),
103
- isDektopScreen ? (React.createElement(Button, { busy: checkoutFlowStatus === "loading", testID: "confirm-checkout-button", onPress: handleOnSubmit }, submitButtonText)) : null)) : null))),
104
+ isDektopScreen && React.createElement(PaymentButton, null))) : null))),
104
105
  pricing && !isDektopScreen ? (React.createElement(Sticky, { style: style.sticky, onLayout: Platform.OS !== "web" ? handleOnPricingLayout : undefined },
105
106
  React.createElement(Body, null,
106
- React.createElement(Button, { busy: checkoutFlowStatus === "loading", testID: "confirm-checkout-button", small: true, onPress: handleOnSubmit }, submitButtonText)))) : null,
107
+ React.createElement(PaymentButton, null)))) : null,
107
108
  paymentFlowComponent));
108
109
  };
109
110
  export { Checkout };
@@ -1 +1,2 @@
1
- export declare const VERSION = "12.23.0";
1
+ export declare const VERSION = "12.24.0";
2
+ export declare const RELEASE = "checkout@12.24.0";
@@ -1 +1,2 @@
1
- export const VERSION = "12.23.0";
1
+ export const VERSION = "12.24.0";
2
+ export const RELEASE = "checkout@12.24.0";
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/naming-convention */
2
- import {
2
+ import React, {
3
3
  FC,
4
4
  forwardRef,
5
5
  ForwardRefExoticComponent,
@@ -7,6 +7,7 @@ import {
7
7
  RefAttributes,
8
8
  useImperativeHandle,
9
9
  } from "react";
10
+ import { Button } from "@lookiero/aurora";
10
11
  import { PaymentPayload } from "@lookiero/payments-front";
11
12
 
12
13
  let startLegacyBoxCheckoutListener: ({ success }: { success: boolean }) => void;
@@ -54,10 +55,12 @@ const usePaymentStatusManager: (section: Section) => UsePaymentStatusManagerResu
54
55
 
55
56
  enum Section {
56
57
  BOX_CHECKOUT = "box-checkout",
58
+ DIRECT_BUY_CHECKOUT = "direct-buy-checkout",
57
59
  }
58
60
 
59
- export type { PaymentFlowRef };
61
+ const PayButton: FC = ({ ...props }) => <Button {...props}>Pay</Button>;
60
62
 
63
+ export type { PaymentFlowRef };
61
64
  export {
62
65
  PaymentsQueryProvider,
63
66
  PaymentInstrumentSelect,
@@ -65,4 +68,5 @@ export {
65
68
  Section,
66
69
  setPaymentsBridge,
67
70
  usePaymentStatusManager,
71
+ PayButton,
68
72
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "12.23.0",
3
+ "version": "12.24.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": "false",
@@ -46,7 +46,7 @@
46
46
  "@config-plugins/detox": "^6.0.0",
47
47
  "@lookiero/eslint-config-sty-psp": "*",
48
48
  "@lookiero/event": "^0.3",
49
- "@lookiero/payments-front": "^7.0.0",
49
+ "@lookiero/payments-front": "^9.2.0",
50
50
  "@lookiero/sty-psp-jest-config": "*",
51
51
  "@lookiero/sty-psp-prettier-config": "*",
52
52
  "@lookiero/sty-psp-scripts": "*",
@@ -76,7 +76,7 @@
76
76
  "@lookiero/event": "^0.3",
77
77
  "@lookiero/i18n": ">=3",
78
78
  "@lookiero/i18n-react": ">=3",
79
- "@lookiero/payments-front": ">=7",
79
+ "@lookiero/payments-front": ">=9",
80
80
  "apollo-boost": "0.4.4",
81
81
  "expo": ">=52",
82
82
  "expo-font": ">=12",
package/src/ExpoRoot.tsx CHANGED
@@ -7,7 +7,7 @@ import { Aurora, Text } from "@lookiero/aurora";
7
7
  import { EventProvider } from "@lookiero/event";
8
8
  import { EndpointFunction } from "@lookiero/i18n";
9
9
  import { i18n } from "@lookiero/i18n-react";
10
- import { PaymentsQueryProvider, setPaymentsBridge } from "@lookiero/payments-front";
10
+ import { FeatureFlags, PaymentsQueryProvider, setPaymentsBridge } from "@lookiero/payments-front";
11
11
  import { fetchTranslations, Project, translationExternalEndpoint } from "@lookiero/sty-psp-i18n";
12
12
  import { Country, Locale } from "@lookiero/sty-psp-locale";
13
13
  import { SentryEnvironment } from "@lookiero/sty-psp-logging";
@@ -25,7 +25,7 @@ import { OrderProjection } from "./projection/order/order";
25
25
  import { SubscriptionProjection } from "./projection/subscription/subscription";
26
26
  import { VERSION } from "./version";
27
27
 
28
- const tradename = Tradename.LOOKIERO;
28
+ const tradename = Tradename.OUTFITTERY;
29
29
  const theme = themeByTradename({ tradename });
30
30
  const locale: Locale = Locale.es_ES;
31
31
 
@@ -37,7 +37,7 @@ const order: OrderProjection = {
37
37
  };
38
38
 
39
39
  const customer: Customer = {
40
- customerId: "6bf2156d-aa5f-432a-88c9-578e9b6992fa",
40
+ customerId: "f943ae75-bffb-4b14-b418-e8c79da41dde",
41
41
  country: Country.ES,
42
42
  segment: Segment.WOMEN,
43
43
  email: "email@example.com",
@@ -60,7 +60,7 @@ const apiUrl =
60
60
  : "http://localhost:3004/local-to-dev"
61
61
  : "/checkout/api";
62
62
  const authToken =
63
- "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEzMTA4NTY4LCJleHAiOjE3NjAyNjEzNDIsImRpc3BsYXlOYW1lIjoiTWlrZWwiLCJjb3VudHJ5X2NvZGUiOiJFUyIsImFjY2Vzc1ZpYSI6ImVtYWlsIiwic3Vic2NyaXB0aW9uU3RhcnRpbmdEYXRlIjoiMjAyNS0wOS0xMSIsImltcGVyc29uYXRlZCI6ZmFsc2UsInV1aWQiOiJhYjIzN2FiMy1mOWY2LTRiNWItOTNjMi1lNjg3YzJmOTlkMmMiLCJ0cmFkZW5hbWUiOiJMT09LSUVSTyIsImlhdCI6MTc1NzY2OTM0Mn0.mw9E6PLIc0KeXe7AdDcxxJrZZuGATxVoht5jDOlDXrk";
63
+ "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEzNDQzMjA4LCJleHAiOjE3NjQzNDQwNjUsImRpc3BsYXlOYW1lIjoiQWxleGFuZGVyIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjUtMTAtMjciLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiZjk0M2FlNzUtYmZmYi00YjE0LWI0MTgtZThjNzlkYTQxZGRlIiwidHJhZGVuYW1lIjoiT1VURklUVEVSWSIsImlhdCI6MTc2MTY2NTY2NX0.ACQlI_HmEytLQCWNLXPStOwNdrOKjU9IHW4ezrHoquc";
64
64
  const getAuthToken = () => Promise.resolve(authToken);
65
65
 
66
66
  const externalTranslationsUrl =
@@ -104,10 +104,11 @@ setPaymentsBridge({
104
104
  },
105
105
  appVersion: VERSION,
106
106
  graphqlUri: "/graphql",
107
- useFeatureFlags: () => ({}),
108
- locale: () => Promise.resolve("es-ES"),
107
+ useFeatureFlags: () => ({}) as Record<FeatureFlags, boolean>,
108
+ locale: () => "es-ES",
109
109
  scrollView: ScrollView,
110
110
  hostUrl: "",
111
+ tradename,
111
112
  });
112
113
 
113
114
  const kameleoonConfig: KameleoonEnvironment = {
@@ -48,7 +48,6 @@ enum I18nMessages {
48
48
  SUMMARY_FEE = "summary.fee",
49
49
  PRODUCT_VARIANT_SIZE_CHANGE = "product_variant.size_change",
50
50
  CHECKOUT_TITLE = "checkout.title",
51
- CHECKOUT_PAY_BUTTON = "checkout.pay_button",
52
51
  CHECKOUT_TOAST_PAYMENT_ERROR = "checkout.toast_payment_error",
53
52
  CHECKOUT_TOAST_PAYMENT_SUCCESS = "checkout.toast_payment_success",
54
53
  CHECKOUT_SUCCESS_MODAL_TITLE = "checkout.success_modal_title",
@@ -120,8 +120,7 @@ describe("Checkout view", () => {
120
120
 
121
121
  expect(getByTestId(paymentFlowTestId)).toBeTruthy();
122
122
 
123
- expect(getByText(I18nMessages.CHECKOUT_PAY_BUTTON)).toBeTruthy();
124
- fireEvent.press(getByText(I18nMessages.CHECKOUT_PAY_BUTTON));
123
+ fireEvent.press(getByTestId("confirm-checkout-button"));
125
124
  expect(mockTrackPressContinue).toHaveBeenCalled();
126
125
  expect(mockCheckoutFlow).toHaveBeenCalled();
127
126
 
@@ -1,9 +1,10 @@
1
1
  import React, { FC, useCallback, useMemo, useState } from "react";
2
2
  import { LayoutRectangle, Platform, ScrollView, View } from "react-native";
3
3
  import { useNavigate } from "react-router-native";
4
- import { Box, Button, Layout as AuroraLayout, Spinner, Text } from "@lookiero/aurora";
4
+ import { Box, Layout as AuroraLayout, Spinner, Text } from "@lookiero/aurora";
5
5
  import { useI18nMessage } from "@lookiero/i18n-react";
6
6
  import { QueryStatus } from "@lookiero/messaging-react";
7
+ import { PayButton, Section } from "@lookiero/payments-front";
7
8
  import { Country } from "@lookiero/sty-psp-locale";
8
9
  import { Layout as UiLayout, Sticky, useScreenSize } from "@lookiero/sty-psp-ui";
9
10
  import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
@@ -55,7 +56,6 @@ const Checkout: FC<CheckoutProps> = ({
55
56
  const style = useMemo(() => checkoutStyle(), []);
56
57
 
57
58
  const titleText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.CHECKOUT_TITLE });
58
- const submitButtonText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.CHECKOUT_PAY_BUTTON });
59
59
  const [pricingHeight, setPricingHeight] = useState(0);
60
60
  const handleOnPricingLayout = useCallback(({ height }: LayoutRectangle) => setPricingHeight(height), []);
61
61
 
@@ -117,6 +117,20 @@ const Checkout: FC<CheckoutProps> = ({
117
117
  navigate(`${basePath}/${Routes.SUMMARY}`);
118
118
  }, [basePath, navigate, trackPressBack]);
119
119
 
120
+ const PaymentButton = () =>
121
+ useMemo(
122
+ () => (
123
+ <PayButton
124
+ busy={checkoutFlowStatus === "loading"}
125
+ section={Section.BOX_CHECKOUT}
126
+ testID="confirm-checkout-button"
127
+ small
128
+ onPress={handleOnSubmit}
129
+ />
130
+ ),
131
+ [],
132
+ );
133
+
120
134
  const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
121
135
  const dependenciesLoaded =
122
136
  (dependenciesLoadedStatuses.includes(checkoutStatus) || checkout) &&
@@ -186,15 +200,7 @@ const Checkout: FC<CheckoutProps> = ({
186
200
  <View style={[style.princingWrapper, !isDektopScreen && style.princingWrapperSmall]}>
187
201
  <Pricing pricing={pricing} totalCheckoutItemsKept={checkoutItemsKept?.length || 0} />
188
202
 
189
- {isDektopScreen ? (
190
- <Button
191
- busy={checkoutFlowStatus === "loading"}
192
- testID="confirm-checkout-button"
193
- onPress={handleOnSubmit}
194
- >
195
- {submitButtonText}
196
- </Button>
197
- ) : null}
203
+ {isDektopScreen && <PaymentButton />}
198
204
  </View>
199
205
  ) : null}
200
206
  </Box>
@@ -204,14 +210,7 @@ const Checkout: FC<CheckoutProps> = ({
204
210
  {pricing && !isDektopScreen ? (
205
211
  <Sticky style={style.sticky} onLayout={Platform.OS !== "web" ? handleOnPricingLayout : undefined}>
206
212
  <Body>
207
- <Button
208
- busy={checkoutFlowStatus === "loading"}
209
- testID="confirm-checkout-button"
210
- small
211
- onPress={handleOnSubmit}
212
- >
213
- {submitButtonText}
214
- </Button>
213
+ <PaymentButton />
215
214
  </Body>
216
215
  </Sticky>
217
216
  ) : null}