@lookiero/checkout 12.22.0 → 12.23.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.
- package/dist/fake-dependencies/@lookiero/payments-front/index.d.ts +7 -2
- package/dist/fake-dependencies/@lookiero/payments-front/index.js +5 -2
- package/dist/public/public/assets/adaptive-icon.png +0 -0
- package/dist/public/public/assets/favicon.png +0 -0
- package/dist/public/public/assets/icon.png +0 -0
- package/dist/public/public/assets/splash.png +0 -0
- package/dist/public/public/images/not-found.png +0 -0
- package/dist/src/ExpoRoot.js +5 -4
- package/dist/src/domain/checkoutBooking/command/blockCheckoutBooking.d.ts +13 -0
- package/dist/src/domain/checkoutBooking/command/blockCheckoutBooking.js +4 -0
- package/dist/src/domain/checkoutBooking/model/checkoutBookingBlocked.d.ts +13 -0
- package/dist/src/domain/checkoutBooking/model/checkoutBookingBlocked.js +4 -0
- package/dist/src/domain/checkoutItem/model/currency.d.ts +6 -0
- package/dist/src/domain/checkoutItem/model/currency.js +7 -0
- package/dist/src/domain/uiSetting/command/updateUiSetting.d.ts +15 -0
- package/dist/src/domain/uiSetting/command/updateUiSetting.js +10 -0
- package/dist/src/domain/uiSetting/model/uiSetting.d.ts +9 -0
- package/dist/src/domain/uiSetting/model/uiSetting.js +11 -0
- package/dist/src/domain/uiSetting/model/uiSettingUpdated.d.ts +15 -0
- package/dist/src/domain/uiSetting/model/uiSettingUpdated.js +8 -0
- package/dist/src/domain/uiSetting/model/uiSettings.d.ts +7 -0
- package/dist/src/domain/uiSetting/model/uiSettings.js +1 -0
- package/dist/src/infrastructure/domain/checkoutBooking/model/httpCheckoutBookingsBlock.d.ts +5 -0
- package/dist/src/infrastructure/domain/checkoutBooking/model/httpCheckoutBookingsBlock.js +15 -0
- package/dist/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.d.ts +15 -0
- package/dist/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.js +29 -0
- package/dist/src/infrastructure/domain/uiSetting/model/storageUiSettings.d.ts +17 -0
- package/dist/src/infrastructure/domain/uiSetting/model/storageUiSettings.js +20 -0
- package/dist/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.d.ts +18 -0
- package/dist/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.js +22 -0
- package/dist/src/infrastructure/persistence/asyncStorageStorage.d.ts +5 -0
- package/dist/src/infrastructure/persistence/asyncStorageStorage.js +7 -0
- package/dist/src/infrastructure/persistence/uiSettingData.d.ts +6 -0
- package/dist/src/infrastructure/persistence/uiSettingData.js +1 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.d.ts +3 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.js +103 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.d.ts +12 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.js +10 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.d.ts +10 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.js +9 -0
- package/dist/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.d.ts +10 -0
- package/dist/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.js +11 -0
- package/dist/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.d.ts +13 -0
- package/dist/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.js +15 -0
- package/dist/src/infrastructure/ui/i18n/i18n.d.ts +0 -1
- package/dist/src/infrastructure/ui/i18n/i18n.js +0 -1
- package/dist/src/infrastructure/ui/settings/UISettings.d.ts +3 -0
- package/dist/src/infrastructure/ui/settings/UISettings.js +4 -0
- package/dist/src/infrastructure/ui/views/checkout/Checkout.js +5 -4
- package/dist/src/projection/checkoutQuestion/checkoutQuestion.d.ts +18 -0
- package/dist/src/projection/checkoutQuestion/checkoutQuestion.js +10 -0
- package/dist/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.d.ts +25 -0
- package/dist/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.js +8 -0
- package/dist/src/projection/uiSetting/viewUiSettingByKey.d.ts +29 -0
- package/dist/src/projection/uiSetting/viewUiSettingByKey.js +8 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/fake-dependencies/@lookiero/payments-front/index.tsx +9 -2
- package/package.json +3 -3
- package/src/ExpoRoot.tsx +7 -6
- package/src/infrastructure/ui/i18n/i18n.ts +0 -1
- package/src/infrastructure/ui/views/checkout/Checkout.test.tsx +1 -2
- package/src/infrastructure/ui/views/checkout/Checkout.tsx +18 -19
|
@@ -16,7 +16,12 @@ 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
|
+
interface PayButtonProps {
|
|
23
|
+
readonly onPress: () => void;
|
|
24
|
+
}
|
|
25
|
+
declare const PayButton: FC<PayButtonProps>;
|
|
21
26
|
export type { PaymentFlowRef };
|
|
22
|
-
export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, usePaymentStatusManager, };
|
|
27
|
+
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
|
-
|
|
30
|
+
const PayButton = ({ onPress }) => React.createElement(Button, { onPress: onPress }, "Pay");
|
|
31
|
+
export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, usePaymentStatusManager, PayButton, };
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/src/ExpoRoot.js
CHANGED
|
@@ -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.
|
|
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: "
|
|
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.
|
|
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: () =>
|
|
89
|
+
locale: () => "es-ES",
|
|
90
90
|
scrollView: ScrollView,
|
|
91
91
|
hostUrl: "",
|
|
92
|
+
tradename,
|
|
92
93
|
});
|
|
93
94
|
const kameleoonConfig = {
|
|
94
95
|
siteCode: "aplm4v3ckn",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from "@lookiero/messaging";
|
|
2
|
+
declare const BLOCK_CHECKOUT_BOOKING = "block_checkout_booking";
|
|
3
|
+
interface BlockCheckoutBookingPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface BlockCheckoutBooking extends Command<typeof BLOCK_CHECKOUT_BOOKING>, BlockCheckoutBookingPayload {
|
|
7
|
+
}
|
|
8
|
+
interface BlockCheckoutBookingFunction {
|
|
9
|
+
(payload: BlockCheckoutBookingPayload): BlockCheckoutBooking;
|
|
10
|
+
}
|
|
11
|
+
declare const blockCheckoutBooking: BlockCheckoutBookingFunction;
|
|
12
|
+
export type { BlockCheckoutBooking };
|
|
13
|
+
export { BLOCK_CHECKOUT_BOOKING, blockCheckoutBooking };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainEvent } from "@lookiero/messaging";
|
|
2
|
+
declare const CHECKOUT_BOOKING_BLOCKED = "checkout_booking_blocked";
|
|
3
|
+
interface CheckoutBookingBlokedPaylcoad {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface CheckoutBookingBlocked extends DomainEvent<typeof CHECKOUT_BOOKING_BLOCKED>, CheckoutBookingBlokedPaylcoad {
|
|
7
|
+
}
|
|
8
|
+
interface CheckoutBookingBlokedFunctcion {
|
|
9
|
+
(payload: CheckoutBookingBlokedPaylcoad): CheckoutBookingBlocked;
|
|
10
|
+
}
|
|
11
|
+
declare const checkoutBookingBlocked: CheckoutBookingBlokedFunctcion;
|
|
12
|
+
export type { CheckoutBookingBlocked };
|
|
13
|
+
export { CHECKOUT_BOOKING_BLOCKED, checkoutBookingBlocked };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { domainEvent } from "@lookiero/messaging";
|
|
2
|
+
const CHECKOUT_BOOKING_BLOCKED = "checkout_booking_blocked";
|
|
3
|
+
const checkoutBookingBlocked = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_BOOKING_BLOCKED });
|
|
4
|
+
export { CHECKOUT_BOOKING_BLOCKED, checkoutBookingBlocked };
|
|
@@ -0,0 +1,15 @@
|
|
|
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 };
|
|
@@ -0,0 +1,10 @@
|
|
|
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 };
|
|
@@ -0,0 +1,9 @@
|
|
|
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 };
|
|
@@ -0,0 +1,11 @@
|
|
|
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 };
|
|
@@ -0,0 +1,15 @@
|
|
|
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 };
|
|
@@ -0,0 +1,8 @@
|
|
|
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 };
|
|
@@ -0,0 +1,7 @@
|
|
|
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 };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HttpCheckoutBookingsSaveFunction } from "./httpCheckoutBookings";
|
|
2
|
+
interface HttpCheckoutBookingsBlockFunction extends HttpCheckoutBookingsSaveFunction {
|
|
3
|
+
}
|
|
4
|
+
declare const httpCheckoutBookingsBlock: HttpCheckoutBookingsBlockFunction;
|
|
5
|
+
export { httpCheckoutBookingsBlock };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CHECKOUT_BOOKING_BLOCKED, } from "../../../../domain/checkoutBooking/model/checkoutBookingBlocked";
|
|
2
|
+
const isCheckoutBookingBlocked = (event) => event.name === CHECKOUT_BOOKING_BLOCKED;
|
|
3
|
+
const httpCheckoutBookingsBlock = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
|
|
4
|
+
const checkoutBookingBlocked = domainEvents.find(isCheckoutBookingBlocked);
|
|
5
|
+
if (!checkoutBookingBlocked) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
await httpPost({
|
|
9
|
+
endpoint: "/block-checkout-booking",
|
|
10
|
+
body: {
|
|
11
|
+
checkoutBookingId: aggregateId,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export { httpCheckoutBookingsBlock };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
import { Logger } from "@lookiero/sty-psp-logging";
|
|
3
|
+
interface BlockCheckoutBookingFunction {
|
|
4
|
+
(): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
type UseBlockCheckoutBooking = [blockCheckoutBooking: BlockCheckoutBookingFunction, status: CommandStatus];
|
|
7
|
+
interface UseBlockCheckoutBookingFunctionArgs {
|
|
8
|
+
readonly checkoutBookingId: string | undefined;
|
|
9
|
+
readonly logger: Logger;
|
|
10
|
+
}
|
|
11
|
+
interface UseBlockCheckoutBookingFunction {
|
|
12
|
+
(args: UseBlockCheckoutBookingFunctionArgs): UseBlockCheckoutBooking;
|
|
13
|
+
}
|
|
14
|
+
declare const useBlockCheckoutBooking: UseBlockCheckoutBookingFunction;
|
|
15
|
+
export { useBlockCheckoutBooking };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import invariant from "tiny-invariant";
|
|
3
|
+
import { useCommand } from "@lookiero/messaging-react";
|
|
4
|
+
import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
|
|
5
|
+
import { blockCheckoutBooking as blockCheckoutBookingCommand } from "../../../../domain/checkoutBooking/command/blockCheckoutBooking";
|
|
6
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
7
|
+
import { I18nMessages } from "../../../ui/i18n/i18n";
|
|
8
|
+
const useBlockCheckoutBooking = ({ checkoutBookingId, logger }) => {
|
|
9
|
+
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
10
|
+
const [createNotification] = useCreateToastNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
|
|
11
|
+
const blockCheckoutBooking = useCallback(async () => {
|
|
12
|
+
invariant(checkoutBookingId, "checkoutBookingId is required");
|
|
13
|
+
try {
|
|
14
|
+
await commandBus(blockCheckoutBookingCommand({
|
|
15
|
+
aggregateId: checkoutBookingId,
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
logger.captureException(error);
|
|
20
|
+
createNotification({
|
|
21
|
+
level: NotificationLevel.ERROR,
|
|
22
|
+
bodyI18nKey: I18nMessages.TOAST_GENERIC_ERROR,
|
|
23
|
+
});
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
}, [checkoutBookingId, commandBus, createNotification, logger]);
|
|
27
|
+
return [blockCheckoutBooking, status];
|
|
28
|
+
};
|
|
29
|
+
export { useBlockCheckoutBooking };
|
|
@@ -0,0 +1,17 @@
|
|
|
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 };
|
|
@@ -0,0 +1,20 @@
|
|
|
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 };
|
|
@@ -0,0 +1,18 @@
|
|
|
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 };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 };
|
|
@@ -0,0 +1,7 @@
|
|
|
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 };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { CheckoutQuestionType, } from "../../../projection/checkoutQuestion/checkoutQuestion";
|
|
2
|
+
const checkoutQuestions = [
|
|
3
|
+
{
|
|
4
|
+
id: "efe07b97-f6fb-4b6a-ba92-b68519320b2c",
|
|
5
|
+
name: "checkout_question.selection.question",
|
|
6
|
+
placeholder: "checkout_question.selection.placeholder",
|
|
7
|
+
type: CheckoutQuestionType.HOST_SELECT,
|
|
8
|
+
showCondition: [],
|
|
9
|
+
children: [
|
|
10
|
+
{
|
|
11
|
+
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
12
|
+
name: "checkout_question.icon.bad",
|
|
13
|
+
placeholder: "",
|
|
14
|
+
type: CheckoutQuestionType.ICON,
|
|
15
|
+
showCondition: [],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
19
|
+
name: "checkout_question.icon.regular",
|
|
20
|
+
placeholder: "",
|
|
21
|
+
type: CheckoutQuestionType.ICON,
|
|
22
|
+
showCondition: [],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
26
|
+
name: "checkout_question.icon.good",
|
|
27
|
+
placeholder: "",
|
|
28
|
+
type: CheckoutQuestionType.ICON,
|
|
29
|
+
showCondition: [],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "6a6d3878-5561-412c-96f3-7ed79ee587bb",
|
|
35
|
+
name: "checkout_question.experience.question",
|
|
36
|
+
placeholder: "checkout_question.experience.placeholder",
|
|
37
|
+
type: CheckoutQuestionType.HOST_SELECT,
|
|
38
|
+
showCondition: [],
|
|
39
|
+
children: [
|
|
40
|
+
{
|
|
41
|
+
id: "a3d937b6-7499-4a3c-86bf-5c0af9ab2e23",
|
|
42
|
+
name: "checkout_question.icon.bad",
|
|
43
|
+
placeholder: "",
|
|
44
|
+
type: CheckoutQuestionType.ICON,
|
|
45
|
+
showCondition: [],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "7970edd3-fb5c-42d3-afe3-ce31bcbb856c",
|
|
49
|
+
name: "checkout_question.icon.regular",
|
|
50
|
+
placeholder: "",
|
|
51
|
+
type: CheckoutQuestionType.ICON,
|
|
52
|
+
showCondition: [],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "bab3d4f9-0227-4550-a53f-3c125d68429c",
|
|
56
|
+
name: "checkout_question.icon.good",
|
|
57
|
+
placeholder: "",
|
|
58
|
+
type: CheckoutQuestionType.ICON,
|
|
59
|
+
showCondition: [],
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "a1acdb2d-62c8-467f-b7cc-dc24d967290c",
|
|
65
|
+
name: "checkout_question.personalshopper.question",
|
|
66
|
+
placeholder: "checkout_question.personalshopper.placeholder",
|
|
67
|
+
type: CheckoutQuestionType.HOST_SELECT,
|
|
68
|
+
showCondition: ["68c0bb98-b00a-4b86-af43-528fe903cb69"],
|
|
69
|
+
children: [
|
|
70
|
+
{
|
|
71
|
+
id: "cce7851c-92c7-461b-8dcb-903c5de59ed1",
|
|
72
|
+
name: "checkout_question.personalshopper.yes",
|
|
73
|
+
placeholder: "",
|
|
74
|
+
type: CheckoutQuestionType.BUTTON,
|
|
75
|
+
showCondition: [],
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "4bf8f27d-669b-4d36-8d39-b5599c671816",
|
|
79
|
+
name: "checkout_question.personalshopper.no",
|
|
80
|
+
placeholder: "",
|
|
81
|
+
type: CheckoutQuestionType.BUTTON,
|
|
82
|
+
showCondition: [],
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: "ce3e8d57-5eea-4dd3-bef4-2e811a143612",
|
|
88
|
+
name: "checkout_question.comment.question",
|
|
89
|
+
placeholder: "",
|
|
90
|
+
type: CheckoutQuestionType.HOST_TEXTAREA,
|
|
91
|
+
showCondition: [],
|
|
92
|
+
children: [
|
|
93
|
+
{
|
|
94
|
+
id: "1123a37d-bc00-43a4-9d28-cee1dfaf356c",
|
|
95
|
+
name: "checkout_question.comment.question",
|
|
96
|
+
placeholder: "checkout_question.comment.placeholder",
|
|
97
|
+
type: CheckoutQuestionType.TEXTAREA,
|
|
98
|
+
showCondition: [],
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
export { checkoutQuestions };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HttpPostFunction } from "@lookiero/sty-psp-http";
|
|
2
|
+
import { CheckoutQuestionsByCheckoutIdView } from "../../../projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId";
|
|
3
|
+
interface HttpCheckoutQuestionsByCheckoutIdView extends CheckoutQuestionsByCheckoutIdView {
|
|
4
|
+
}
|
|
5
|
+
interface HttpCheckoutQuestionsByCheckoutIdViewFunctionArgs {
|
|
6
|
+
readonly httpPost: HttpPostFunction;
|
|
7
|
+
}
|
|
8
|
+
interface HttpCheckoutQuestionsByCheckoutIdViewFunction {
|
|
9
|
+
(args: HttpCheckoutQuestionsByCheckoutIdViewFunctionArgs): HttpCheckoutQuestionsByCheckoutIdView;
|
|
10
|
+
}
|
|
11
|
+
declare const httpCheckoutQuestionsByCheckoutIdView: HttpCheckoutQuestionsByCheckoutIdViewFunction;
|
|
12
|
+
export { httpCheckoutQuestionsByCheckoutIdView };
|
package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const httpCheckoutQuestionsByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => await httpPost({
|
|
2
|
+
endpoint: "/list-checkout-questions-by-checkout-id",
|
|
3
|
+
body: { checkoutId },
|
|
4
|
+
signal,
|
|
5
|
+
result: {
|
|
6
|
+
error: null,
|
|
7
|
+
success: (response) => response.result,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export { httpCheckoutQuestionsByCheckoutIdView };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
|
+
import { CheckoutQuestionProjection } from "../../../../projection/checkoutQuestion/checkoutQuestion";
|
|
3
|
+
interface UseListChckoutQuestionsByCheckoutIdFunctionArgs {
|
|
4
|
+
readonly checkoutId: string;
|
|
5
|
+
}
|
|
6
|
+
interface UseListChckoutQuestionsByCheckoutIdFunction {
|
|
7
|
+
(args: UseListChckoutQuestionsByCheckoutIdFunctionArgs): UseQueryFunctionResult<CheckoutQuestionProjection[]>;
|
|
8
|
+
}
|
|
9
|
+
declare const useListCheckoutQuestionsByCheckoutId: UseListChckoutQuestionsByCheckoutIdFunction;
|
|
10
|
+
export { useListCheckoutQuestionsByCheckoutId };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
+
import { listCheckoutQuestionsByCheckoutId } from "../../../../projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId";
|
|
3
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
4
|
+
const useListCheckoutQuestionsByCheckoutId = ({ checkoutId }) => useQuery({
|
|
5
|
+
query: listCheckoutQuestionsByCheckoutId({ checkoutId }),
|
|
6
|
+
contextId: MESSAGING_CONTEXT_ID,
|
|
7
|
+
options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
8
|
+
});
|
|
9
|
+
export { useListCheckoutQuestionsByCheckoutId };
|
|
@@ -0,0 +1,10 @@
|
|
|
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 };
|
|
@@ -0,0 +1,11 @@
|
|
|
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 };
|
|
@@ -0,0 +1,13 @@
|
|
|
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 };
|
|
@@ -0,0 +1,15 @@
|
|
|
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 };
|
|
@@ -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,
|
|
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
|
|
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(
|
|
107
|
+
React.createElement(PaymentButton, null)))) : null,
|
|
107
108
|
paymentFlowComponent));
|
|
108
109
|
};
|
|
109
110
|
export { Checkout };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare enum CheckoutQuestionType {
|
|
2
|
+
HOST_DEFAULT = "HOST_DEFAULT",
|
|
3
|
+
HOST_TEXTAREA = "HOST_TEXTAREA",
|
|
4
|
+
HOST_SELECT = "HOST_SELECT",
|
|
5
|
+
TEXTAREA = "TEXTAREA",
|
|
6
|
+
ICON = "ICON",
|
|
7
|
+
BUTTON = "BUTTON"
|
|
8
|
+
}
|
|
9
|
+
interface CheckoutQuestionProjection {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly placeholder: string;
|
|
13
|
+
readonly type: CheckoutQuestionType;
|
|
14
|
+
readonly children?: CheckoutQuestionProjection[];
|
|
15
|
+
readonly showCondition: string[];
|
|
16
|
+
}
|
|
17
|
+
export { CheckoutQuestionType };
|
|
18
|
+
export type { CheckoutQuestionProjection };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var CheckoutQuestionType;
|
|
2
|
+
(function (CheckoutQuestionType) {
|
|
3
|
+
CheckoutQuestionType["HOST_DEFAULT"] = "HOST_DEFAULT";
|
|
4
|
+
CheckoutQuestionType["HOST_TEXTAREA"] = "HOST_TEXTAREA";
|
|
5
|
+
CheckoutQuestionType["HOST_SELECT"] = "HOST_SELECT";
|
|
6
|
+
CheckoutQuestionType["TEXTAREA"] = "TEXTAREA";
|
|
7
|
+
CheckoutQuestionType["ICON"] = "ICON";
|
|
8
|
+
CheckoutQuestionType["BUTTON"] = "BUTTON";
|
|
9
|
+
})(CheckoutQuestionType || (CheckoutQuestionType = {}));
|
|
10
|
+
export { CheckoutQuestionType };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
import { CheckoutQuestionProjection } from "./checkoutQuestion";
|
|
3
|
+
declare const LIST_CHECKOUT_QUESTIONS_BY_CHECKOUT_ID = "list_checkout_questions_by_checkout_id";
|
|
4
|
+
interface ListCheckoutQuestionsByCheckoutIdPayload {
|
|
5
|
+
readonly checkoutId: string;
|
|
6
|
+
}
|
|
7
|
+
interface ListCheckoutQuestionsByCheckoutId extends Query<typeof LIST_CHECKOUT_QUESTIONS_BY_CHECKOUT_ID>, ListCheckoutQuestionsByCheckoutIdPayload {
|
|
8
|
+
}
|
|
9
|
+
interface ListCheckoutQuestionsByCheckoutIdFunction {
|
|
10
|
+
(payload: ListCheckoutQuestionsByCheckoutIdPayload): ListCheckoutQuestionsByCheckoutId;
|
|
11
|
+
}
|
|
12
|
+
declare const listCheckoutQuestionsByCheckoutId: ListCheckoutQuestionsByCheckoutIdFunction;
|
|
13
|
+
type ListCheckoutQuestionsByCheckoutIdResult = CheckoutQuestionProjection[] | null;
|
|
14
|
+
interface CheckoutQuestionsByCheckoutIdViewArgs extends CancelableQueryViewArgs {
|
|
15
|
+
readonly checkoutId: string;
|
|
16
|
+
}
|
|
17
|
+
interface CheckoutQuestionsByCheckoutIdView {
|
|
18
|
+
(args: CheckoutQuestionsByCheckoutIdViewArgs): Promise<ListCheckoutQuestionsByCheckoutIdResult>;
|
|
19
|
+
}
|
|
20
|
+
interface ListCheckoutQuestionsByCheckoutIdHandlerFunctionArgs extends QueryHandlerFunctionArgs {
|
|
21
|
+
readonly view: CheckoutQuestionsByCheckoutIdView;
|
|
22
|
+
}
|
|
23
|
+
declare const listCheckoutQuestionsByCheckoutIdHandler: QueryHandlerFunction<ListCheckoutQuestionsByCheckoutId, ListCheckoutQuestionsByCheckoutIdResult, ListCheckoutQuestionsByCheckoutIdHandlerFunctionArgs>;
|
|
24
|
+
export type { ListCheckoutQuestionsByCheckoutId, CheckoutQuestionsByCheckoutIdView, ListCheckoutQuestionsByCheckoutIdResult, };
|
|
25
|
+
export { LIST_CHECKOUT_QUESTIONS_BY_CHECKOUT_ID, listCheckoutQuestionsByCheckoutId, listCheckoutQuestionsByCheckoutIdHandler, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { query, } from "@lookiero/messaging";
|
|
2
|
+
const LIST_CHECKOUT_QUESTIONS_BY_CHECKOUT_ID = "list_checkout_questions_by_checkout_id";
|
|
3
|
+
const listCheckoutQuestionsByCheckoutId = (payload) => ({
|
|
4
|
+
...query({ name: LIST_CHECKOUT_QUESTIONS_BY_CHECKOUT_ID }),
|
|
5
|
+
...payload,
|
|
6
|
+
});
|
|
7
|
+
const listCheckoutQuestionsByCheckoutIdHandler = ({ view, signal }) => async ({ checkoutId }) => view({ checkoutId, signal });
|
|
8
|
+
export { LIST_CHECKOUT_QUESTIONS_BY_CHECKOUT_ID, listCheckoutQuestionsByCheckoutId, listCheckoutQuestionsByCheckoutIdHandler, };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
interface UiSettingProjection {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly key: string;
|
|
5
|
+
readonly value: unknown;
|
|
6
|
+
}
|
|
7
|
+
declare const VIEW_UI_SETTING_BY_KEY = "view_ui_setting_by_key";
|
|
8
|
+
interface ViewUiSettingByKeyPayload {
|
|
9
|
+
readonly key: string;
|
|
10
|
+
}
|
|
11
|
+
interface ViewUiSettingByKey extends Query<typeof VIEW_UI_SETTING_BY_KEY>, ViewUiSettingByKeyPayload {
|
|
12
|
+
}
|
|
13
|
+
interface ViewUiSettingByKeyFunction {
|
|
14
|
+
(payload: ViewUiSettingByKeyPayload): ViewUiSettingByKey;
|
|
15
|
+
}
|
|
16
|
+
declare const viewUiSettingByKey: ViewUiSettingByKeyFunction;
|
|
17
|
+
type ViewUiSettingByKeyResult = UiSettingProjection | null;
|
|
18
|
+
interface UiSettingByKeyViewArgs {
|
|
19
|
+
readonly key: string;
|
|
20
|
+
}
|
|
21
|
+
interface UiSettingByKeyView {
|
|
22
|
+
(args: UiSettingByKeyViewArgs): Promise<ViewUiSettingByKeyResult>;
|
|
23
|
+
}
|
|
24
|
+
interface ViewUiSettingByKeyHandlerFunctionArgs extends QueryHandlerFunctionArgs {
|
|
25
|
+
readonly view: UiSettingByKeyView;
|
|
26
|
+
}
|
|
27
|
+
declare const viewUiSettingByKeyHandler: QueryHandlerFunction<ViewUiSettingByKey, ViewUiSettingByKeyResult, ViewUiSettingByKeyHandlerFunctionArgs>;
|
|
28
|
+
export type { UiSettingProjection, UiSettingByKeyView };
|
|
29
|
+
export { VIEW_UI_SETTING_BY_KEY, viewUiSettingByKey, viewUiSettingByKeyHandler };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { query } from "@lookiero/messaging";
|
|
2
|
+
const VIEW_UI_SETTING_BY_KEY = "view_ui_setting_by_key";
|
|
3
|
+
const viewUiSettingByKey = (payload) => ({
|
|
4
|
+
...query({ name: VIEW_UI_SETTING_BY_KEY }),
|
|
5
|
+
...payload,
|
|
6
|
+
});
|
|
7
|
+
const viewUiSettingByKeyHandler = ({ view }) => async ({ key }) => view({ key });
|
|
8
|
+
export { VIEW_UI_SETTING_BY_KEY, viewUiSettingByKey, viewUiSettingByKeyHandler };
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "12.
|
|
1
|
+
export declare const VERSION = "12.23.0-beta.0";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "12.
|
|
1
|
+
export const VERSION = "12.23.0-beta.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,15 @@ 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
|
-
|
|
61
|
+
interface PayButtonProps {
|
|
62
|
+
readonly onPress: () => void;
|
|
63
|
+
}
|
|
64
|
+
const PayButton: FC<PayButtonProps> = ({ onPress }) => <Button onPress={onPress}>Pay</Button>;
|
|
60
65
|
|
|
66
|
+
export type { PaymentFlowRef };
|
|
61
67
|
export {
|
|
62
68
|
PaymentsQueryProvider,
|
|
63
69
|
PaymentInstrumentSelect,
|
|
@@ -65,4 +71,5 @@ export {
|
|
|
65
71
|
Section,
|
|
66
72
|
setPaymentsBridge,
|
|
67
73
|
usePaymentStatusManager,
|
|
74
|
+
PayButton,
|
|
68
75
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.23.0-beta.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": "^
|
|
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": ">=
|
|
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.
|
|
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: "
|
|
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.
|
|
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: () =>
|
|
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
|
-
|
|
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,
|
|
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
|
-
<
|
|
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}
|