@lookiero/checkout 15.2.4 → 15.3.0-beta.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.
@@ -61,10 +61,10 @@ setPaymentsBridge({
61
61
  },
62
62
  appVersion: RELEASE,
63
63
  graphqlUri: "/graphql",
64
- useFeatureFlags: () => ({}),
65
64
  locale: () => "es-ES",
66
65
  scrollView: ScrollView,
67
66
  hostUrl: "",
67
+ host: "",
68
68
  tradename,
69
69
  });
70
70
  const kameleoonConfig = {
@@ -0,0 +1,31 @@
1
+ import { Tradename } from "@lookiero/sty-sp-tradename";
2
+ import { PriceProjection } from "../../../projection/price/price";
3
+ import { CheckoutPricingProjection } from "../../../projection/pricing/pricing";
4
+ interface ServiceDto {
5
+ readonly discount: PriceProjection;
6
+ readonly finalPrice: PriceProjection;
7
+ readonly originalPrice: PriceProjection;
8
+ readonly prepaid: boolean;
9
+ readonly reference: string;
10
+ readonly paidWithPromocode?: boolean;
11
+ }
12
+ interface PricingDto {
13
+ readonly balanceDiscount: PriceProjection;
14
+ readonly discount: PriceProjection;
15
+ readonly discountPercentage: number;
16
+ readonly orderTotal: PriceProjection;
17
+ readonly pendingToPay: PriceProjection;
18
+ readonly service: ServiceDto;
19
+ readonly subtotal: PriceProjection;
20
+ }
21
+ interface ToPricingProjectionFunctionArgs {
22
+ readonly pricing: PricingDto;
23
+ readonly tradename: Tradename;
24
+ readonly migrated: boolean;
25
+ }
26
+ interface ToPricingProjectionFunction {
27
+ (args: ToPricingProjectionFunctionArgs): CheckoutPricingProjection;
28
+ }
29
+ declare const toPricingProjection: ToPricingProjectionFunction;
30
+ export type { PricingDto };
31
+ export { toPricingProjection };
@@ -0,0 +1,39 @@
1
+ import { Tradename } from "@lookiero/sty-sp-tradename";
2
+ import { CheckoutPricingContext, CheckoutPricingType, } from "../../../projection/pricing/pricing";
3
+ const toPricingProjection = ({ pricing, tradename, migrated, }) => {
4
+ const shouldDisplayPsFeeModifier = tradename === Tradename.LOOKIERO || (tradename === Tradename.OUTFITTERY && !migrated);
5
+ const modifiers = [
6
+ {
7
+ amount: pricing.discount.amount,
8
+ type: CheckoutPricingType.DISCOUNT,
9
+ context: CheckoutPricingContext.PROMOCODE,
10
+ translationKey: "summary.discount",
11
+ percentage: pricing.discountPercentage,
12
+ },
13
+ {
14
+ amount: pricing.balanceDiscount.amount,
15
+ type: CheckoutPricingType.DISCOUNT,
16
+ context: CheckoutPricingContext.BALANCE,
17
+ translationKey: "summary.credit",
18
+ },
19
+ ...(shouldDisplayPsFeeModifier
20
+ ? [
21
+ {
22
+ amount: pricing.service.finalPrice.amount,
23
+ type: CheckoutPricingType.DISCOUNT,
24
+ context: CheckoutPricingContext.PS_FEE,
25
+ translationKey: "summary.fee",
26
+ },
27
+ ]
28
+ : []),
29
+ ]
30
+ .map((modifier) => ({ ...modifier, amount: Math.abs(modifier.amount) }))
31
+ .filter(({ amount }) => amount !== 0);
32
+ return {
33
+ currency: pricing.pendingToPay.currency,
34
+ finalPrice: pricing.pendingToPay.amount,
35
+ originalPrice: pricing.subtotal.amount,
36
+ modifiers,
37
+ };
38
+ };
39
+ export { toPricingProjection };
@@ -93,7 +93,7 @@ const useCheckoutFlow = ({ checkout: checkoutProjection, getAuthToken, onSuccess
93
93
  }
94
94
  return "idle";
95
95
  }, [startLegacyBoxCheckoutStatus, submitCheckoutStatus, checkoutBookingExpired]);
96
- const paymentFlow = useMemo(() => (authToken ? React.createElement(PaymentFlow, { ref: paymentFlowRef, section: Section.BOX_CHECKOUT, token: authToken }) : null), [authToken]);
96
+ const paymentFlow = useMemo(() => (authToken ? React.createElement(PaymentFlow, { ref: paymentFlowRef, section: Section.BOX_CHECKOUT }) : null), [authToken]);
97
97
  return useMemo(() => [checkoutFlow, checkoutFlowStatus, paymentFlow], [checkoutFlow, paymentFlow, checkoutFlowStatus]);
98
98
  };
99
99
  export { useCheckoutFlow };
@@ -4,9 +4,10 @@ import { useStaticInfo } from "../../../../hooks/useStaticInfo";
4
4
  const PaymentInstrument = ({ useRedirect }) => {
5
5
  const { returnUrl } = useRedirect();
6
6
  const { customer } = useStaticInfo();
7
- return (React.createElement(PaymentInstrumentSelect, { beforeRedirect: returnUrl ? () => Promise.resolve(returnUrl) : undefined, hasError: false, section: Section.BOX_CHECKOUT, userInformation: {
7
+ return (React.createElement(PaymentInstrumentSelect, { beforeRedirect: returnUrl ? () => Promise.resolve(returnUrl) : undefined, section: Section.BOX_CHECKOUT, userInformation: {
8
8
  email: customer.email,
9
9
  name: customer.name,
10
+ segment: customer.segment,
10
11
  }, showSingleUsePaymentMethods: true }));
11
12
  };
12
13
  export { PaymentInstrument };
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "15.2.4";
2
- export declare const RELEASE = "checkout@15.2.4";
1
+ export declare const VERSION = "15.3.0-beta.0";
2
+ export declare const RELEASE = "checkout@15.3.0-beta.0";
@@ -1,2 +1,2 @@
1
- export const VERSION = "15.2.4";
2
- export const RELEASE = "checkout@15.2.4";
1
+ export const VERSION = "15.3.0-beta.0";
2
+ export const RELEASE = "checkout@15.3.0-beta.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "15.2.4",
3
+ "version": "15.3.0-beta.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": "false",
@@ -51,7 +51,7 @@
51
51
  "@config-plugins/detox": "^6.0.0",
52
52
  "@lookiero/eslint-config-sty-psp": "*",
53
53
  "@lookiero/event": "^0.3",
54
- "@lookiero/payments-front": "^9.2.0",
54
+ "@lookiero/payments-front": "14.1.0",
55
55
  "@lookiero/sty-psp-jest-config": "*",
56
56
  "@lookiero/sty-psp-prettier-config": "*",
57
57
  "@lookiero/sty-psp-scripts": "*",
@@ -83,7 +83,7 @@
83
83
  "@lookiero/event": "^0.3",
84
84
  "@lookiero/i18n": ">=3",
85
85
  "@lookiero/i18n-react": ">=3",
86
- "@lookiero/payments-front": ">=9",
86
+ "@lookiero/payments-front": ">=14",
87
87
  "apollo-boost": "0.4.4",
88
88
  "expo": ">=54",
89
89
  "expo-font": ">=12",
package/src/ExpoRoot.tsx CHANGED
@@ -5,7 +5,7 @@ import { Platform, ScrollView } from "react-native";
5
5
  import { Navigate, Route, Routes } from "react-router-native";
6
6
  import { Aurora } from "@lookiero/aurora";
7
7
  import { EventProvider } from "@lookiero/event";
8
- import { FeatureFlags, PaymentsQueryProvider, setPaymentsBridge } from "@lookiero/payments-front";
8
+ import { PaymentsQueryProvider, setPaymentsBridge } from "@lookiero/payments-front";
9
9
  import { Country, Locale } from "@lookiero/sty-psp-locale";
10
10
  import { SentryEnvironment } from "@lookiero/sty-psp-logging";
11
11
  import { Segment } from "@lookiero/sty-psp-segment";
@@ -73,10 +73,10 @@ setPaymentsBridge({
73
73
  },
74
74
  appVersion: RELEASE,
75
75
  graphqlUri: "/graphql",
76
- useFeatureFlags: () => ({}) as Record<FeatureFlags, boolean>,
77
76
  locale: () => "es-ES",
78
77
  scrollView: ScrollView,
79
78
  hostUrl: "",
79
+ host: "",
80
80
  tradename,
81
81
  });
82
82
 
@@ -1,7 +1,7 @@
1
1
  import React, { ReactNode, useCallback, useEffect, useMemo, useRef, useState } from "react";
2
2
  import { CheckoutTrackingEvent } from "src/infrastructure/tracking/tracking";
3
3
  import { CommandStatus } from "@lookiero/messaging-react";
4
- import { PaymentFlow, PaymentFlowRef, PaymentPayload, Section } from "@lookiero/payments-front";
4
+ import { PaymentFlow, PaymentFlowStrategies, PaymentPayload, Section } from "@lookiero/payments-front";
5
5
  import { LegacyBoxCheckoutStrategyPayload } from "@lookiero/payments-front/build/components/PaymentFlow/internals/strategies/LegacyBoxCheckoutStrategy";
6
6
  import { useLogger } from "@lookiero/sty-psp-logging";
7
7
  import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
@@ -60,7 +60,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({ checkout: checkoutProjection
60
60
  basePath,
61
61
  tradename,
62
62
  } = useStaticInfo();
63
- const paymentFlowRef = useRef<PaymentFlowRef>(null);
63
+ const paymentFlowRef = useRef<PaymentFlowStrategies>(null);
64
64
  const [paymentFlowPayload] = useViewPaymentFlowPayloadByCheckoutId({
65
65
  checkoutId: checkoutProjection?.id as string,
66
66
  });
@@ -157,7 +157,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({ checkout: checkoutProjection
157
157
  }, [startLegacyBoxCheckoutStatus, submitCheckoutStatus, checkoutBookingExpired]);
158
158
 
159
159
  const paymentFlow = useMemo(
160
- () => (authToken ? <PaymentFlow ref={paymentFlowRef} section={Section.BOX_CHECKOUT} token={authToken} /> : null),
160
+ () => (authToken ? <PaymentFlow ref={paymentFlowRef} section={Section.BOX_CHECKOUT} /> : null),
161
161
  [authToken],
162
162
  );
163
163
 
@@ -12,11 +12,11 @@ const PaymentInstrument: FC<PaymentInstrumentProps> = ({ useRedirect }) => {
12
12
  return (
13
13
  <PaymentInstrumentSelect
14
14
  beforeRedirect={returnUrl ? () => Promise.resolve(returnUrl) : undefined}
15
- hasError={false}
16
15
  section={Section.BOX_CHECKOUT}
17
16
  userInformation={{
18
17
  email: customer.email,
19
18
  name: customer.name,
19
+ segment: customer.segment,
20
20
  }}
21
21
  showSingleUsePaymentMethods
22
22
  />
File without changes