@lookiero/checkout 0.4.5 → 0.4.6-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/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.d.ts +6 -0
- package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.js +13 -0
- package/dist/index.js +1 -3
- package/dist/infrastructure/delivery/baseBootstrap.js +56 -48
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +13 -0
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js +14 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.d.ts +12 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +9 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.d.ts +10 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.js +12 -0
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts +12 -0
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js +9 -0
- package/dist/infrastructure/ui/Root.d.ts +0 -2
- package/dist/infrastructure/ui/Root.js +2 -3
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.d.ts +1 -0
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +7 -5
- package/dist/infrastructure/ui/hooks/useSubmitCheckout.js +2 -1
- package/dist/infrastructure/ui/i18n/i18n.d.ts +2 -1
- package/dist/infrastructure/ui/i18n/i18n.js +1 -0
- package/dist/infrastructure/ui/views/App.js +2 -1
- package/dist/infrastructure/ui/views/checkout/Checkout.js +1 -1
- package/dist/infrastructure/ui/views/feedback/Feedback.js +1 -1
- package/dist/infrastructure/ui/views/header/Header.d.ts +1 -1
- package/dist/infrastructure/ui/views/header/Header.js +9 -6
- package/dist/infrastructure/ui/views/item/Item.js +1 -2
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +3 -1
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.d.ts +0 -1
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.js +1 -2
- package/dist/infrastructure/ui/views/summary/Summary.js +16 -10
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.js +3 -1
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.style.d.ts +0 -1
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.style.js +1 -2
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +10 -0
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js +1 -0
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.d.ts +25 -0
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.js +8 -0
- package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.d.ts +25 -0
- package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.js +8 -0
- package/dist/shared/notifications/infrastructure/delivery/bootstrap.d.ts +9 -1
- package/dist/shared/notifications/infrastructure/delivery/bootstrap.js +5 -1
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.d.ts +4 -1
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js +2 -3
- package/dist/shared/notifications/infrastructure/domain/notification/react/useRemoveNotification.d.ts +4 -1
- package/dist/shared/notifications/infrastructure/domain/notification/react/useRemoveNotification.js +2 -3
- package/dist/shared/notifications/infrastructure/ui/views/Notifications.d.ts +4 -1
- package/dist/shared/notifications/infrastructure/ui/views/Notifications.js +3 -3
- package/dist/shared/notifications/projection/notification/react/useListNotifications.d.ts +4 -1
- package/dist/shared/notifications/projection/notification/react/useListNotifications.js +2 -3
- package/dist/shared/ui/components/atoms/field/Field.js +1 -1
- package/dist/shared/ui/components/atoms/field/Field.style.d.ts +2 -0
- package/dist/shared/ui/components/atoms/field/Field.style.js +2 -0
- package/dist/shared/ui/components/atoms/input/Input.js +1 -1
- package/dist/shared/ui/components/atoms/input/Input.style.d.ts +0 -3
- package/dist/shared/ui/components/atoms/input/Input.style.js +3 -3
- package/dist/shared/ui/components/layouts/sticky/Sticky.style.d.ts +3 -0
- package/dist/shared/ui/components/layouts/sticky/Sticky.style.js +4 -9
- package/dist/shared/ui/components/molecules/inputField/InputField.js +6 -1
- package/package.json +2 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ProcessManagerFunction } from "@lookiero/messaging";
|
|
2
|
+
import { CheckoutBookingExpired } from "../model/checkoutBookingExpired";
|
|
3
|
+
interface CreateNotificationWhenCheckoutBookingExpiredFunction extends ProcessManagerFunction<CheckoutBookingExpired> {
|
|
4
|
+
}
|
|
5
|
+
declare const createNotificationWhenCheckoutBookingExpired: CreateNotificationWhenCheckoutBookingExpiredFunction;
|
|
6
|
+
export { createNotificationWhenCheckoutBookingExpired };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { v4 as uuid } from "uuid";
|
|
2
|
+
import { I18nMessages } from "../../../infrastructure/ui/i18n/i18n";
|
|
3
|
+
import { createNotification } from "../../../shared/notifications/domain/notification/command/createNotification";
|
|
4
|
+
import { NotificationLevel } from "../../../shared/notifications/domain/notification/model/notification";
|
|
5
|
+
const createNotificationWhenCheckoutBookingExpired = ({ commandBus }) => async () => {
|
|
6
|
+
await commandBus(createNotification({
|
|
7
|
+
aggregateId: uuid(),
|
|
8
|
+
level: NotificationLevel.ERROR,
|
|
9
|
+
titleI18nKey: undefined,
|
|
10
|
+
bodyI18nKey: I18nMessages.CHECKOUT_TOAST_BOOKING_EXPIRED,
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
export { createNotificationWhenCheckoutBookingExpired };
|
package/dist/index.js
CHANGED
|
@@ -3,15 +3,13 @@ import { i18n } from "@lookiero/i18n-react";
|
|
|
3
3
|
import { bootstrap as checkoutBootstrap } from "./infrastructure/delivery/bootstrap";
|
|
4
4
|
import { root } from "./infrastructure/ui/Root";
|
|
5
5
|
import { viewIsCheckoutAccessibleByCustomerId, } from "./projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
6
|
-
import { notificationsRoot } from "./shared/notifications";
|
|
7
6
|
const bootstrap = ({ apiUrl, getAuthToken, translations }) => {
|
|
8
7
|
const { Component: Messaging, queryBus } = checkoutBootstrap({ apiUrl, getAuthToken });
|
|
9
8
|
const I18n = i18n({
|
|
10
9
|
fetchTranslation: fetchFetchTranslation({ endpoint: translations }),
|
|
11
10
|
contextId: "CheckoutI18n",
|
|
12
11
|
});
|
|
13
|
-
const
|
|
14
|
-
const Root = root({ Messaging, I18n, Notifications, getAuthToken });
|
|
12
|
+
const Root = root({ Messaging, I18n, getAuthToken });
|
|
15
13
|
const isCheckoutAccessible = ({ customerId }) => queryBus(viewIsCheckoutAccessibleByCustomerId({ customerId }));
|
|
16
14
|
return {
|
|
17
15
|
Root,
|
|
@@ -4,7 +4,9 @@ import { START_CHECKOUT } from "../../domain/checkout/command/startCheckout";
|
|
|
4
4
|
import { markCheckoutAsPaidHandler, startCheckoutHandler } from "../../domain/checkout/model/checkout";
|
|
5
5
|
import { BLOCK_CHECKOUT_BOOKING } from "../../domain/checkoutBooking/command/blockCheckoutBooking";
|
|
6
6
|
import { BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM } from "../../domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem";
|
|
7
|
+
import { createNotificationWhenCheckoutBookingExpired } from "../../domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired";
|
|
7
8
|
import { blockCheckoutBookingHandler, bookCheckoutBookingForCheckoutItemHandler, } from "../../domain/checkoutBooking/model/checkoutBooking";
|
|
9
|
+
import { CHECKOUT_BOOKING_EXPIRED } from "../../domain/checkoutBooking/model/checkoutBookingExpired";
|
|
8
10
|
import { GIVE_CHECKOUT_FEEDBACK } from "../../domain/checkoutFeedback/command/giveCheckoutFeedback";
|
|
9
11
|
import { giveCheckoutFeedbackHandler } from "../../domain/checkoutFeedback/model/checkoutFeedback";
|
|
10
12
|
import { KEEP_CHECKOUT_ITEM } from "../../domain/checkoutItem/command/keepCheckoutItem";
|
|
@@ -26,53 +28,59 @@ import { viewPaymentFlowPayloadByCheckoutIdHandler, VIEW_PAYMENT_FLOW_PAYLOAD_BY
|
|
|
26
28
|
import { viewPricingByCheckoutIdHandler, VIEW_PRICING_BY_CHECKOUT_ID, } from "../../projection/pricing/viewPricingByCheckoutId";
|
|
27
29
|
import { listReturnQuestionsByCheckoutItemIdHandler, LIST_RETURN_QUESTIONS_BY_CHECKOUT_ITEM_ID, } from "../../projection/returnQuestion/listReturnQuestionsByCheckoutItemId";
|
|
28
30
|
import { viewUiSettingByKeyHandler, VIEW_UI_SETTING_BY_KEY, } from "../../projection/uiSetting/viewUiSettingByKey";
|
|
31
|
+
import { bootstrapWithBuilder as bootstrapNotifications } from "../../shared/notifications/infrastructure/delivery/bootstrap";
|
|
32
|
+
import { inMemoryStorageNotifications } from "../../shared/notifications/infrastructure/persistence/inMemoryStorageNotifications";
|
|
29
33
|
const MESSAGING_CONTEXT_ID = "Checkout";
|
|
30
|
-
const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, fiveItemsDiscountByCustomerIdView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView, bookedProductsVariantsForCheckoutItemView, checkoutBookingByIdView, pricingByCheckoutIdView, paymentFlowPayloadByCheckoutIdView, checkoutQuestionsByCheckoutIdView, uiSettingByKeyView, getUiSetting, saveUiSetting, uiSettingsDependencies, getCheckout, saveCheckout, checkoutsDependencies, getCheckoutItem, saveCheckoutItem, checkoutItemsDependencies, getCheckoutBooking, saveCheckoutBooking, checkoutBookingsDependencies, getCheckoutFeedback, saveCheckoutFeedback, checkoutFeedbacksDependencies, }) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
34
|
+
const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, fiveItemsDiscountByCustomerIdView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView, bookedProductsVariantsForCheckoutItemView, checkoutBookingByIdView, pricingByCheckoutIdView, paymentFlowPayloadByCheckoutIdView, checkoutQuestionsByCheckoutIdView, uiSettingByKeyView, getUiSetting, saveUiSetting, uiSettingsDependencies, getCheckout, saveCheckout, checkoutsDependencies, getCheckoutItem, saveCheckoutItem, checkoutItemsDependencies, getCheckoutBooking, saveCheckoutBooking, checkoutBookingsDependencies, getCheckoutFeedback, saveCheckoutFeedback, checkoutFeedbacksDependencies, }) => {
|
|
35
|
+
let messaging = messagingBootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
36
|
+
.query(VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, viewFiveItemsDiscountByCustomerIdHandler, {
|
|
37
|
+
view: fiveItemsDiscountByCustomerIdView,
|
|
38
|
+
})
|
|
39
|
+
.query(VIEW_CHECKOUT_BY_ID, viewCheckoutByIdHandler, {
|
|
40
|
+
view: checkoutByIdView,
|
|
41
|
+
})
|
|
42
|
+
.query(VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerIdHandler, {
|
|
43
|
+
view: firstAvailableCheckoutByCustomerIdView,
|
|
44
|
+
})
|
|
45
|
+
.query(VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, viewIsCheckoutEnabledByCustomerIdHandler, {
|
|
46
|
+
view: isCheckoutEnabledByCustomerIdView,
|
|
47
|
+
})
|
|
48
|
+
.query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler)
|
|
49
|
+
.command(START_CHECKOUT, startCheckoutHandler)(getCheckout, saveCheckout, ...checkoutsDependencies)
|
|
50
|
+
.command(MARK_CHECKOUT_AS_PAID, markCheckoutAsPaidHandler)(getCheckout, saveCheckout, ...checkoutsDependencies)
|
|
51
|
+
.query(VIEW_CHECKOUT_ITEM_BY_ID, viewCheckoutItemByIdHandler, {
|
|
52
|
+
view: checkoutItemByIdView,
|
|
53
|
+
})
|
|
54
|
+
.query(LIST_RETURN_QUESTIONS_BY_CHECKOUT_ITEM_ID, listReturnQuestionsByCheckoutItemIdHandler, {
|
|
55
|
+
view: returnQuestionsByCheckoutItemIdView,
|
|
56
|
+
})
|
|
57
|
+
.command(KEEP_CHECKOUT_ITEM, keepCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
|
|
58
|
+
.command(RETURN_CHECKOUT_ITEM, returnCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
|
|
59
|
+
.command(REPLACE_CHECKOUT_ITEM, replaceCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
|
|
60
|
+
.query(VIEW_PRICING_BY_CHECKOUT_ID, viewPricingByCheckoutIdHandler, {
|
|
61
|
+
view: pricingByCheckoutIdView,
|
|
62
|
+
})
|
|
63
|
+
.query(VIEW_PAYMENT_FLOW_PAYLOAD_BY_CHECKOUT_ID, viewPaymentFlowPayloadByCheckoutIdHandler, {
|
|
64
|
+
view: paymentFlowPayloadByCheckoutIdView,
|
|
65
|
+
})
|
|
66
|
+
.query(LIST_CHECKOUT_QUESTIONS_BY_CHECKOUT_ID, listCheckoutQuestionsByCheckoutIdHandler, {
|
|
67
|
+
view: checkoutQuestionsByCheckoutIdView,
|
|
68
|
+
})
|
|
69
|
+
.query(VIEW_CHECKOUT_BOOKING_BY_ID, viewCheckoutBookingByIdHandler, {
|
|
70
|
+
view: checkoutBookingByIdView,
|
|
71
|
+
})
|
|
72
|
+
.query(VIEW_BOOKED_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedProductsVariantsForCheckoutItemHandler, {
|
|
73
|
+
view: bookedProductsVariantsForCheckoutItemView,
|
|
74
|
+
})
|
|
75
|
+
.command(BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM, bookCheckoutBookingForCheckoutItemHandler)(getCheckoutBooking, saveCheckoutBooking, ...checkoutBookingsDependencies)
|
|
76
|
+
.command(BLOCK_CHECKOUT_BOOKING, blockCheckoutBookingHandler)(getCheckoutBooking, saveCheckoutBooking, ...checkoutBookingsDependencies)
|
|
77
|
+
.command(GIVE_CHECKOUT_FEEDBACK, giveCheckoutFeedbackHandler)(getCheckoutFeedback, saveCheckoutFeedback, ...checkoutFeedbacksDependencies)
|
|
78
|
+
.query(VIEW_UI_SETTING_BY_KEY, viewUiSettingByKeyHandler, {
|
|
79
|
+
view: uiSettingByKeyView,
|
|
80
|
+
})
|
|
81
|
+
.command(UPDATE_UI_SETTING, updateUiSettingHandler)(getUiSetting, saveUiSetting, ...uiSettingsDependencies)
|
|
82
|
+
.processManager(CHECKOUT_BOOKING_EXPIRED, createNotificationWhenCheckoutBookingExpired);
|
|
83
|
+
messaging = bootstrapNotifications({ messaging, storage: inMemoryStorageNotifications() });
|
|
84
|
+
return messaging.build();
|
|
85
|
+
};
|
|
78
86
|
export { baseBootstrap, MESSAGING_CONTEXT_ID };
|
package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
interface BookFunction {
|
|
3
|
+
(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
type UseBookCheckouBookingForCheckoutItem = [book: BookFunction, status: CommandStatus];
|
|
6
|
+
interface UseBookCheckouBookingForCheckoutItemFunctionArgs {
|
|
7
|
+
readonly checkoutItemId: string;
|
|
8
|
+
}
|
|
9
|
+
interface UseBookCheckouBookingForCheckoutItemFunction {
|
|
10
|
+
(args: UseBookCheckouBookingForCheckoutItemFunctionArgs): UseBookCheckouBookingForCheckoutItem;
|
|
11
|
+
}
|
|
12
|
+
declare const useBookCheckouBookingForCheckoutItem: UseBookCheckouBookingForCheckoutItemFunction;
|
|
13
|
+
export { useBookCheckouBookingForCheckoutItem };
|
package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useCommand } from "@lookiero/messaging-react";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { v4 as uuid } from "uuid";
|
|
4
|
+
import { bookCheckoutBookingForCheckoutItem } from "../../../../domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem";
|
|
5
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
6
|
+
const useBookCheckouBookingForCheckoutItem = ({ checkoutItemId }) => {
|
|
7
|
+
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
|
+
const book = useCallback(() => commandBus(bookCheckoutBookingForCheckoutItem({
|
|
9
|
+
aggregateId: uuid(),
|
|
10
|
+
checkoutItemId,
|
|
11
|
+
})), [checkoutItemId, commandBus]);
|
|
12
|
+
return [book, status];
|
|
13
|
+
};
|
|
14
|
+
export { useBookCheckouBookingForCheckoutItem };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BookedSizeChangeProductsVariantsForCheckoutItemView } from "../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
|
|
2
|
+
import { HttpPostFunction } from "../../delivery/http/httpClient";
|
|
3
|
+
interface HttpBookedSizeChangeProductsVariantsForCheckoutItemView extends BookedSizeChangeProductsVariantsForCheckoutItemView {
|
|
4
|
+
}
|
|
5
|
+
interface HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunctionArgs {
|
|
6
|
+
readonly httpPost: HttpPostFunction;
|
|
7
|
+
}
|
|
8
|
+
interface HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunction {
|
|
9
|
+
(args: HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunctionArgs): HttpBookedSizeChangeProductsVariantsForCheckoutItemView;
|
|
10
|
+
}
|
|
11
|
+
declare const httpBookedSizeChangeProductsVariantsForCheckoutItemView: HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunction;
|
|
12
|
+
export { httpBookedSizeChangeProductsVariantsForCheckoutItemView };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const httpBookedSizeChangeProductsVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
2
|
+
const response = await httpPost({
|
|
3
|
+
endpoint: "/view-booked-size-change-product-variants-for-checkout-item",
|
|
4
|
+
body: { checkoutItemId },
|
|
5
|
+
signal,
|
|
6
|
+
});
|
|
7
|
+
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
+
};
|
|
9
|
+
export { httpBookedSizeChangeProductsVariantsForCheckoutItemView };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
|
+
import { BookedSizeChangeProductsVariantsProjection } from "../../../../projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants";
|
|
3
|
+
interface UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunctionArgs {
|
|
4
|
+
readonly checkoutItemId: string;
|
|
5
|
+
}
|
|
6
|
+
interface UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunction {
|
|
7
|
+
(args: UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunctionArgs): UseQueryFunctionResult<BookedSizeChangeProductsVariantsProjection>;
|
|
8
|
+
}
|
|
9
|
+
declare const useViewBookedSizeChangeProductsVariantsForCheckoutItem: UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunction;
|
|
10
|
+
export { useViewBookedSizeChangeProductsVariantsForCheckoutItem };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
+
import { CHECKOUT_BOOKING_BOOKED, } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
|
|
3
|
+
import { viewBookedSizeChangeProductsVariantsForCheckoutItem } from "../../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
|
|
4
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
5
|
+
const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
|
|
6
|
+
const useViewBookedSizeChangeProductsVariantsForCheckoutItem = ({ checkoutItemId }) => useQuery({
|
|
7
|
+
query: viewBookedSizeChangeProductsVariantsForCheckoutItem({ checkoutItemId }),
|
|
8
|
+
contextId: MESSAGING_CONTEXT_ID,
|
|
9
|
+
invalidation: isCheckoutBookingBooked,
|
|
10
|
+
options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
11
|
+
});
|
|
12
|
+
export { useViewBookedSizeChangeProductsVariantsForCheckoutItem };
|
package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CheckoutFeedbackByCheckoutIdView } from "../../../projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId";
|
|
2
|
+
import { HttpPostFunction } from "../../delivery/http/httpClient";
|
|
3
|
+
interface HttpCheckoutFeebackByCheckoutIdView extends CheckoutFeedbackByCheckoutIdView {
|
|
4
|
+
}
|
|
5
|
+
interface HttpCheckoutFeebackByCheckoutIdViewFunctionArgs {
|
|
6
|
+
readonly httpPost: HttpPostFunction;
|
|
7
|
+
}
|
|
8
|
+
interface HttpCheckoutFeebackByCheckoutIdViewFunction {
|
|
9
|
+
(args: HttpCheckoutFeebackByCheckoutIdViewFunctionArgs): HttpCheckoutFeebackByCheckoutIdView;
|
|
10
|
+
}
|
|
11
|
+
declare const httpCheckoutFeebackByCheckoutIdView: HttpCheckoutFeebackByCheckoutIdViewFunction;
|
|
12
|
+
export { httpCheckoutFeebackByCheckoutIdView };
|
package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const httpCheckoutFeebackByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
|
|
2
|
+
const response = await httpPost({
|
|
3
|
+
endpoint: "/view-checkout-feedback-by-checkout-id",
|
|
4
|
+
body: { checkoutId },
|
|
5
|
+
signal,
|
|
6
|
+
});
|
|
7
|
+
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
+
};
|
|
9
|
+
export { httpCheckoutFeebackByCheckoutIdView };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { I18n } from "@lookiero/i18n-react";
|
|
2
2
|
import { MessagingRoot } from "@lookiero/messaging-react/bootstrap";
|
|
3
3
|
import { FC } from "react";
|
|
4
|
-
import { NotificationsRoot } from "../../shared/notifications";
|
|
5
4
|
import { Menu } from "./views/header/Header";
|
|
6
5
|
interface RootFunctionArgs {
|
|
7
6
|
readonly Messaging: MessagingRoot;
|
|
8
|
-
readonly Notifications: NotificationsRoot;
|
|
9
7
|
readonly I18n: I18n;
|
|
10
8
|
readonly development?: boolean;
|
|
11
9
|
readonly getAuthToken: () => Promise<string>;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
3
|
import { Routing } from "./routing/Routing";
|
|
4
|
-
const root = ({ Messaging, I18n,
|
|
4
|
+
const root = ({ Messaging, I18n, getAuthToken, development }) =>
|
|
5
5
|
// eslint-disable-next-line react/display-name, react/prop-types
|
|
6
6
|
({ basePath, locale = "en", customerId, menu, onNotAccessible, useRedirect }) => {
|
|
7
7
|
const handleOnI18nError = useCallback(() => void 0, []);
|
|
8
8
|
return (React.createElement(Messaging, { includeReactQueryDevTools: Platform.OS === "web" },
|
|
9
|
-
React.createElement(
|
|
10
|
-
React.createElement(Routing, { I18n: I18n, basePath: basePath, customerId: customerId, getAuthToken: getAuthToken, locale: locale, menu: menu, useRedirect: useRedirect, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible }))));
|
|
9
|
+
React.createElement(Routing, { I18n: I18n, basePath: basePath, customerId: customerId, getAuthToken: getAuthToken, locale: locale, menu: menu, useRedirect: useRedirect, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible })));
|
|
11
10
|
};
|
|
12
11
|
export { root };
|
|
@@ -4,6 +4,7 @@ import { Edge } from "react-native-safe-area-context";
|
|
|
4
4
|
type SafeAreaScrollViewStyle = "safeAreaView" | "scrollView";
|
|
5
5
|
interface SafeAreaScrollViewProps {
|
|
6
6
|
readonly children: ReactNode;
|
|
7
|
+
readonly footer?: ReactNode;
|
|
7
8
|
readonly scrollerPaddingTop?: number;
|
|
8
9
|
readonly edges?: Edge[];
|
|
9
10
|
readonly style?: Partial<Record<SafeAreaScrollViewStyle, StyleProp<ViewStyle>>>;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ScrollView } from "react-native";
|
|
2
|
+
import { Platform, ScrollView } from "react-native";
|
|
3
3
|
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
|
-
|
|
4
|
+
import { theme } from "../../theme/theme";
|
|
5
|
+
const { spaceXXXL } = theme();
|
|
6
|
+
const SafeAreaScrollView = ({ children, footer, edges = ["top", "bottom", "left", "right"], style: customStyle, scrollerPaddingTop = 0, }) => {
|
|
5
7
|
const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
6
8
|
return (React.createElement(SafeAreaView, { edges: edges, style: customStyle?.safeAreaView },
|
|
7
9
|
React.createElement(ScrollView, { contentContainerStyle: [
|
|
8
10
|
{
|
|
9
|
-
// Why did we set this??
|
|
10
11
|
paddingTop: safeAreaInsetTop + scrollerPaddingTop,
|
|
11
|
-
paddingBottom: safeAreaInsetBottom,
|
|
12
|
+
paddingBottom: safeAreaInsetBottom + Platform.OS === "android" ? spaceXXXL : 0,
|
|
12
13
|
},
|
|
13
14
|
customStyle?.scrollView,
|
|
14
|
-
] }, children)
|
|
15
|
+
] }, children),
|
|
16
|
+
footer));
|
|
15
17
|
};
|
|
16
18
|
export { SafeAreaScrollView };
|
|
@@ -3,13 +3,14 @@ import { ChargeStatus } from "@lookiero/payments-front/build/infrastructure/Chec
|
|
|
3
3
|
import { useCallback, useMemo, useState } from "react";
|
|
4
4
|
import { useCreateNotification } from "../../../shared/notifications";
|
|
5
5
|
import { NotificationLevel } from "../../../shared/notifications/domain/notification/model/notification";
|
|
6
|
+
import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
|
|
6
7
|
import { useMarkCheckoutAsPaid } from "../../domain/checkout/react/useMarkCheckoutAsPaid";
|
|
7
8
|
import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
|
|
8
9
|
import { I18nMessages } from "../i18n/i18n";
|
|
9
10
|
const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onError }) => {
|
|
10
11
|
const [markAsPaid, markAsPaidStatus] = useMarkCheckoutAsPaid({ checkoutId });
|
|
11
12
|
const [blockCheckoutBooking, blockCheckoutBookingStatus] = useBlockCheckoutBooking({ checkoutBookingId });
|
|
12
|
-
const [createNotification] = useCreateNotification();
|
|
13
|
+
const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID });
|
|
13
14
|
const [startLegacyBoxCheckoutStatus, setStartLegacyBoxCheckoutStatus] = useState("idle");
|
|
14
15
|
const submitCheckout = useCallback(async ({ paymentFlowPayload }) => {
|
|
15
16
|
try {
|
|
@@ -57,6 +57,7 @@ declare enum I18nMessages {
|
|
|
57
57
|
CHECKOUT_DELIVERY_BANNER = "checkout.delivery_banner",
|
|
58
58
|
HEADER_CHECKOUT_TITLE = "header.checkout_title",
|
|
59
59
|
HEADER_COMPLETE_CHECKOUT_TITLE = "header.complete_checkout_title",
|
|
60
|
-
FEEDBACK_BUTTON = "feedback.button"
|
|
60
|
+
FEEDBACK_BUTTON = "feedback.button",
|
|
61
|
+
CHECKOUT_TOAST_BOOKING_EXPIRED = "checkout.toast_booking_expired"
|
|
61
62
|
}
|
|
62
63
|
export { I18nMessages, COLOR_I18N_PREFIX };
|
|
@@ -59,5 +59,6 @@ var I18nMessages;
|
|
|
59
59
|
I18nMessages["HEADER_CHECKOUT_TITLE"] = "header.checkout_title";
|
|
60
60
|
I18nMessages["HEADER_COMPLETE_CHECKOUT_TITLE"] = "header.complete_checkout_title";
|
|
61
61
|
I18nMessages["FEEDBACK_BUTTON"] = "feedback.button";
|
|
62
|
+
I18nMessages["CHECKOUT_TOAST_BOOKING_EXPIRED"] = "checkout.toast_booking_expired";
|
|
62
63
|
})(I18nMessages || (I18nMessages = {}));
|
|
63
64
|
export { I18nMessages, COLOR_I18N_PREFIX };
|
|
@@ -2,10 +2,11 @@ import { PortalProvider } from "@gorhom/portal";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
4
4
|
import { Notifications } from "../../../shared/notifications/infrastructure/ui/views/Notifications";
|
|
5
|
+
import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
|
|
5
6
|
import { style } from "./App.style";
|
|
6
7
|
import { Header } from "./header/Header";
|
|
7
8
|
const App = ({ customerId, menu, children }) => (React.createElement(SafeAreaProvider, null,
|
|
8
9
|
React.createElement(Header, { customerId: customerId, menu: menu, style: style.header }),
|
|
9
|
-
React.createElement(Notifications,
|
|
10
|
+
React.createElement(Notifications, { contextId: MESSAGING_CONTEXT_ID }),
|
|
10
11
|
React.createElement(PortalProvider, null, children)));
|
|
11
12
|
export { App };
|
|
@@ -38,7 +38,7 @@ const Checkout = ({ children, customerId, useRedirect }) => {
|
|
|
38
38
|
if (!dependenciesLoaded)
|
|
39
39
|
return React.createElement(Spinner, null);
|
|
40
40
|
return (React.createElement(React.Fragment, null,
|
|
41
|
-
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" ? HEADER_HEIGHT : 0 },
|
|
41
|
+
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0 },
|
|
42
42
|
React.createElement(Body, { style: { column: style.bodyColumn } },
|
|
43
43
|
hasReplacedCheckoutItem && (React.createElement(View, { style: style.deliveryBannerContainer },
|
|
44
44
|
React.createElement(DeliveryBanner, null))),
|
|
@@ -30,7 +30,7 @@ const Feedback = ({ customerId }) => {
|
|
|
30
30
|
if (!dependenciesLoaded)
|
|
31
31
|
return React.createElement(Spinner, null);
|
|
32
32
|
return (React.createElement(CheckoutQuestionFeedbackProvider, { feedback: {} },
|
|
33
|
-
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" ? HEADER_HEIGHT : 0 },
|
|
33
|
+
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0 },
|
|
34
34
|
React.createElement(Body, { style: { column: style.bodyColumn } },
|
|
35
35
|
React.createElement(CheckoutQuestionsForm, { checkoutQuestions: checkoutQuestions || [], submitButtonDisabled: giveCheckoutFeedbackStatus === CommandStatus.LOADING, onSubmit: handleOnSubmit })))));
|
|
36
36
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import React, { useCallback, useState } from "react";
|
|
4
|
-
import { View } from "react-native";
|
|
5
|
-
import { SafeAreaView
|
|
6
|
-
} from "react-native-safe-area-context";
|
|
4
|
+
import { View, } from "react-native";
|
|
5
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
7
6
|
import { generatePath, useMatch, useNavigate, useParams } from "react-router-native";
|
|
8
7
|
import { ButtonIcon } from "../../../../shared/ui/components/molecules/buttonIcon/ButtonIcon";
|
|
9
8
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
@@ -84,8 +83,12 @@ const Header = ({ customerId, menu: Menu, style: customStyle }) => {
|
|
|
84
83
|
else {
|
|
85
84
|
header = React.createElement(DefaultHeader, { onOpenMenu: handleOnOpenMenu });
|
|
86
85
|
}
|
|
87
|
-
return (React.createElement(
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
return (React.createElement(React.Fragment, null,
|
|
87
|
+
React.createElement(SafeAreaView, { edges: ["top"], style: [
|
|
88
|
+
style.container,
|
|
89
|
+
// Platform.OS === "android" && { paddingTop: StatusBar.currentHeight },
|
|
90
|
+
customStyle,
|
|
91
|
+
] }, header),
|
|
92
|
+
React.createElement(Menu, { isVisible: menuVisible, onClose: handleOnCloseMenu })));
|
|
90
93
|
};
|
|
91
94
|
export { Header };
|
|
@@ -136,7 +136,7 @@ const Item = ({ customerId }) => {
|
|
|
136
136
|
return (React.createElement(ReturnQuestionFeedbackProvider, { feedback: checkoutItem.feedbacks || {} },
|
|
137
137
|
React.createElement(SizeWithoutStockModal, { visible: sizeWithoutStockModalVisible, onDismiss: handleOnHideSizeWithoutStockModal }),
|
|
138
138
|
React.createElement(SizeChangeModal, { visible: sizeChangeModalVisible, onDismiss: handleOnHideSizeChangeModal }),
|
|
139
|
-
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" ? HEADER_HEIGHT : 0 },
|
|
139
|
+
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0, footer: !customerDecissionMade && (React.createElement(ItemActions, { keepButtonLoading: keepCheckoutItemStatus === CommandStatus.LOADING, productVariantSelected: productVariantSelected, productVariants: bookedProductsVariants?.productVariants || [], returnButtonLoading: returnCheckoutItemStatus === CommandStatus.LOADING, sizeSelectorDisabled: replaceCheckoutItemStatus === CommandStatus.LOADING, onKeep: handleOnKeep, onLayout: handleOnStickyLayout, onReplace: handleOnReplace, onReturn: handleOnReturn, onSizeSelectorPress: handleOnShowSizeWithoutStockModal })) },
|
|
140
140
|
React.createElement(Body, null,
|
|
141
141
|
customerDecissionMade && (React.createElement(CustomerDecissionBanner, { checkoutItemStatus: checkoutItem.status, onPress: handleOnBannerPress })),
|
|
142
142
|
React.createElement(View, { style: [style.container, { paddingBottom: Platform.OS === "web" ? spaceXL : stickyHeight }] },
|
|
@@ -145,7 +145,6 @@ const Item = ({ customerId }) => {
|
|
|
145
145
|
React.createElement(ProductVariantDescription, { brand: brand, color: color, name: name, price: price, size: productVariantSelected.size }),
|
|
146
146
|
checkoutItem.status === CheckoutItemStatus.RETURNED && (React.createElement(View, { style: style.feedbackContainer },
|
|
147
147
|
React.createElement(ReturnQuestionsFeedback, { returnQuestions: returnQuestions || [], onEditFeedback: handleOnEditFeedback })))))),
|
|
148
|
-
!customerDecissionMade && (React.createElement(ItemActions, { keepButtonLoading: keepCheckoutItemStatus === CommandStatus.LOADING, productVariantSelected: productVariantSelected, productVariants: bookedProductsVariants?.productVariants || [], returnButtonLoading: returnCheckoutItemStatus === CommandStatus.LOADING, sizeSelectorDisabled: replaceCheckoutItemStatus === CommandStatus.LOADING, onKeep: handleOnKeep, onLayout: handleOnStickyLayout, onReplace: handleOnReplace, onReturn: handleOnReturn, onSizeSelectorPress: handleOnShowSizeWithoutStockModal })),
|
|
149
148
|
React.createElement(ReturnQuestionsForm, { checkoutItemPrice: checkoutItem.price, productVariant: checkoutItem.productVariant, returnQuestions: returnQuestions || [], visible: returnQuestionsVisible, onClose: handleOnHideReturnQuestions, onSubmit: handleOnSubmit })));
|
|
150
149
|
};
|
|
151
150
|
export { Item };
|
|
@@ -8,7 +8,9 @@ import { ButtonIcon } from "../../../../../../shared/ui/components/molecules/but
|
|
|
8
8
|
import { Price } from "../../../../components/atoms/price/Price";
|
|
9
9
|
import { useMediaImage } from "../../../../hooks/useMediaImage";
|
|
10
10
|
import { COLOR_I18N_PREFIX, I18nMessages } from "../../../../i18n/i18n";
|
|
11
|
+
import { theme } from "../../../../theme/theme";
|
|
11
12
|
import { IMAGE_WIDTH, style } from "./ProductVariant.style";
|
|
13
|
+
const { colorContent } = theme();
|
|
12
14
|
const ProductVariant = ({ media, brand, name, price, size, color, status, discarded, style: customStyle, onPress, }) => {
|
|
13
15
|
const uniqueText = useI18nMessage({ id: I18nMessages.ITEM_UNIQUE });
|
|
14
16
|
const colorLabel = useI18nMessage({ id: color.label, prefix: COLOR_I18N_PREFIX });
|
|
@@ -23,7 +25,7 @@ const ProductVariant = ({ media, brand, name, price, size, color, status, discar
|
|
|
23
25
|
width: IMAGE_WIDTH,
|
|
24
26
|
}),
|
|
25
27
|
} }),
|
|
26
|
-
discarded && (React.createElement(Svg, { preserveAspectRatio: "none", style: style.discarded, testID: "discarded", viewBox: "0 0 100 100" },
|
|
28
|
+
discarded && (React.createElement(Svg, { preserveAspectRatio: "none", stroke: colorContent, style: style.discarded, testID: "discarded", viewBox: "0 0 100 100" },
|
|
27
29
|
React.createElement(Line, { vectorEffect: "non-scaling-stroke", x1: "100", x2: "0", y1: "0", y2: "100" })))),
|
|
28
30
|
React.createElement(View, { style: style.descriptionContainer },
|
|
29
31
|
React.createElement(View, null,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../theme/theme";
|
|
3
|
-
const { borderSize,
|
|
3
|
+
const { borderSize, colorGrayscaleL, colorInfo, spaceXS, spaceS, spaceM } = theme();
|
|
4
4
|
const IMAGE_WIDTH = 96;
|
|
5
5
|
const IMAGE_HEIGHT = 120;
|
|
6
6
|
const style = StyleSheet.create({
|
|
@@ -19,7 +19,6 @@ const style = StyleSheet.create({
|
|
|
19
19
|
height: "100%",
|
|
20
20
|
left: 0,
|
|
21
21
|
position: "absolute",
|
|
22
|
-
stroke: colorContent,
|
|
23
22
|
top: 0,
|
|
24
23
|
width: "100%",
|
|
25
24
|
zIndex: 10,
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import { QueryStatus } from "@lookiero/messaging-react";
|
|
4
|
-
import React, { useCallback, useMemo, useState } from "react";
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
5
|
import { Platform, View } from "react-native";
|
|
6
6
|
import { generatePath, useNavigate } from "react-router-native";
|
|
7
7
|
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
8
|
+
import { useCreateNotification } from "../../../../shared/notifications";
|
|
9
|
+
import { NotificationLevel } from "../../../../shared/notifications/domain/notification/model/notification";
|
|
8
10
|
import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner";
|
|
11
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
9
12
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
10
13
|
import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/checkout/react/useViewFiveItemsDiscountByCustomerId";
|
|
11
14
|
import { useViewPricingByCheckoutId } from "../../../projection/pricing/react/useViewPricingByCheckoutId";
|
|
@@ -24,6 +27,11 @@ const { spaceXL } = theme();
|
|
|
24
27
|
const Summary = ({ customerId }) => {
|
|
25
28
|
const titleText = useI18nMessage({ id: I18nMessages.SUMMARY_TITLE });
|
|
26
29
|
const descriptionText = useI18nMessage({ id: I18nMessages.SUMMARY_DESCRIPTION });
|
|
30
|
+
const [create] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID });
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const i = setInterval(() => create({ bodyI18nKey: "Notification body", level: NotificationLevel.ERROR }), 10000);
|
|
33
|
+
return () => clearInterval(i);
|
|
34
|
+
}, [create]);
|
|
27
35
|
const [pricingHeight, setPricingHeight] = useState(0);
|
|
28
36
|
const handleOnPricingLayout = useCallback(({ height }) => setPricingHeight(height), []);
|
|
29
37
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
@@ -43,14 +51,12 @@ const Summary = ({ customerId }) => {
|
|
|
43
51
|
dependenciesLoadedStatuses.includes(fiveItemsDiscountStatus);
|
|
44
52
|
if (!dependenciesLoaded)
|
|
45
53
|
return React.createElement(Spinner, null);
|
|
46
|
-
return (React.createElement(React.
|
|
47
|
-
React.createElement(
|
|
48
|
-
React.createElement(
|
|
49
|
-
|
|
50
|
-
React.createElement(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
React.createElement(CheckoutItemsTabs, { checkoutItemsKept: checkoutItemsKept || [], checkoutItemsReturned: checkoutItemsReturned || [], onPressItem: handleOnPressItem }))),
|
|
54
|
-
pricing && (React.createElement(StickyPricing, { collapsed: pricingCollapsed, pricing: pricing, totalCheckoutItemsKept: checkoutItemsKept?.length || 0, onLayout: Platform.OS !== "web" ? handleOnPricingLayout : undefined, onPress: handleOnPressPricing, onSubmit: handleOnSubmit }))));
|
|
54
|
+
return (React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0, style: { safeAreaView: style.container }, footer: pricing && (React.createElement(StickyPricing, { collapsed: pricingCollapsed, pricing: pricing, totalCheckoutItemsKept: checkoutItemsKept?.length || 0, onLayout: Platform.OS !== "web" ? handleOnPricingLayout : undefined, onPress: handleOnPressPricing, onSubmit: handleOnSubmit })) },
|
|
55
|
+
React.createElement(Body, { style: { row: { paddingBottom: pricingHeight || spaceXL } } },
|
|
56
|
+
fiveItemsDiscount !== 0 && React.createElement(FiveItemsDiscountBanner, { fiveItemsDiscount: fiveItemsDiscount }),
|
|
57
|
+
React.createElement(View, { style: style.content },
|
|
58
|
+
React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
|
|
59
|
+
React.createElement(Text, { level: 3, style: style.description, body: true }, descriptionText)),
|
|
60
|
+
React.createElement(CheckoutItemsTabs, { checkoutItemsKept: checkoutItemsKept || [], checkoutItemsReturned: checkoutItemsReturned || [], onPressItem: handleOnPressItem }))));
|
|
55
61
|
};
|
|
56
62
|
export { Summary };
|
|
@@ -6,9 +6,11 @@ import React from "react";
|
|
|
6
6
|
import { Pressable, View } from "react-native";
|
|
7
7
|
import { Price } from "../../../../components/atoms/price/Price";
|
|
8
8
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
9
|
+
import { theme } from "../../../../theme/theme";
|
|
9
10
|
import { style } from "./Pricing.style";
|
|
10
11
|
import { ArrowDown } from "./icons/ArrowDown";
|
|
11
12
|
import { ArrowUp } from "./icons/ArrowUp";
|
|
13
|
+
const { colorGrayscaleS } = theme();
|
|
12
14
|
const PS_SERVICE_FREE_INDICATOR = 100;
|
|
13
15
|
const Row = ({ text, level = 3, children }) => (React.createElement(View, { style: style.row },
|
|
14
16
|
React.createElement(Text, { level: level, style: style.uppercase, action: true }, text),
|
|
@@ -32,7 +34,7 @@ const Pricing = ({ orderTotal, subtotal, balanceDiscount, discount, discountPerc
|
|
|
32
34
|
const collapsedStyle = useSpring({ opacitiy: collapsed ? 1 : 0 });
|
|
33
35
|
const notCollapsedStyle = useSpring({ opacitiy: collapsed ? 0 : 1 });
|
|
34
36
|
return (React.createElement(Pressable, { testID: "pricing", onPress: collapsible ? onPress : null },
|
|
35
|
-
collapsible && (React.createElement(View, { style: style.iconContainer }, collapsed ? (React.createElement(ArrowUp, { style: style.icon, testID: "arrow-up" })) : (React.createElement(ArrowDown, { style: style.icon, testID: "arrow-down" })))),
|
|
37
|
+
collapsible && (React.createElement(View, { style: style.iconContainer }, collapsed ? (React.createElement(ArrowUp, { stroke: colorGrayscaleS, style: style.icon, testID: "arrow-up" })) : (React.createElement(ArrowDown, { stroke: colorGrayscaleS, style: style.icon, testID: "arrow-down" })))),
|
|
36
38
|
collapsed && collapsible ? (React.createElement(animated.View, { style: [style.collapsed, { opacity: collapsedStyle.opacitiy }] },
|
|
37
39
|
React.createElement(View, null,
|
|
38
40
|
React.createElement(Text, { level: 1, style: style.totalCollapsed, detail: true },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../theme/theme";
|
|
3
|
-
const { colorContent,
|
|
3
|
+
const { colorContent, spaceXS, spaceL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
5
|
collapsed: {
|
|
6
6
|
flexDirection: "row",
|
|
@@ -13,7 +13,6 @@ const style = StyleSheet.create({
|
|
|
13
13
|
},
|
|
14
14
|
icon: {
|
|
15
15
|
height: 10,
|
|
16
|
-
stroke: colorGrayscaleS,
|
|
17
16
|
width: 58,
|
|
18
17
|
},
|
|
19
18
|
iconContainer: {
|
package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SizeProjection } from "../shared/size";
|
|
2
|
+
interface ProductVariantProjection {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly size: SizeProjection;
|
|
5
|
+
}
|
|
6
|
+
interface BookedSizeChangeProductsVariantsProjection {
|
|
7
|
+
readonly bookingId: string;
|
|
8
|
+
readonly productVariants: ProductVariantProjection[];
|
|
9
|
+
}
|
|
10
|
+
export type { BookedSizeChangeProductsVariantsProjection, ProductVariantProjection };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
import { BookedSizeChangeProductsVariantsProjection } from "./bookedSizeChangeProductsVariants";
|
|
3
|
+
declare const VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "view_booked_size_change_product_variants_for_checkout_item";
|
|
4
|
+
interface ViewBookedSizeChangeProductsVariantsForCheckoutItemPayload {
|
|
5
|
+
readonly checkoutItemId: string;
|
|
6
|
+
}
|
|
7
|
+
interface ViewBookedSizeChangeProductsVariantsForCheckoutItem extends Query<typeof VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM>, ViewBookedSizeChangeProductsVariantsForCheckoutItemPayload {
|
|
8
|
+
}
|
|
9
|
+
interface ViewBookedSizeChangeProductsVariantsForCheckoutItemFunction {
|
|
10
|
+
(payload: ViewBookedSizeChangeProductsVariantsForCheckoutItemPayload): ViewBookedSizeChangeProductsVariantsForCheckoutItem;
|
|
11
|
+
}
|
|
12
|
+
declare const viewBookedSizeChangeProductsVariantsForCheckoutItem: ViewBookedSizeChangeProductsVariantsForCheckoutItemFunction;
|
|
13
|
+
type ViewBookedSizeChangeProductsVariantsForCheckoutItemResult = BookedSizeChangeProductsVariantsProjection | null;
|
|
14
|
+
interface BookedSizeChangeProductsVariantsForCheckoutItemViewArgs extends CancelableQueryViewArgs {
|
|
15
|
+
readonly checkoutItemId: string;
|
|
16
|
+
}
|
|
17
|
+
interface BookedSizeChangeProductsVariantsForCheckoutItemView {
|
|
18
|
+
(args: BookedSizeChangeProductsVariantsForCheckoutItemViewArgs): Promise<ViewBookedSizeChangeProductsVariantsForCheckoutItemResult>;
|
|
19
|
+
}
|
|
20
|
+
interface ViewBookedSizeChangeProductsVariantsForCheckoutItemHandlerFunctionArgs extends QueryHandlerFunctionArgs {
|
|
21
|
+
readonly view: BookedSizeChangeProductsVariantsForCheckoutItemView;
|
|
22
|
+
}
|
|
23
|
+
declare const viewBookedSizeChangeProductsVariantsForCheckoutItemHandler: QueryHandlerFunction<ViewBookedSizeChangeProductsVariantsForCheckoutItem, ViewBookedSizeChangeProductsVariantsForCheckoutItemResult, ViewBookedSizeChangeProductsVariantsForCheckoutItemHandlerFunctionArgs>;
|
|
24
|
+
export type { ViewBookedSizeChangeProductsVariantsForCheckoutItem, BookedSizeChangeProductsVariantsForCheckoutItemView, ViewBookedSizeChangeProductsVariantsForCheckoutItemResult, };
|
|
25
|
+
export { VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedSizeChangeProductsVariantsForCheckoutItem, viewBookedSizeChangeProductsVariantsForCheckoutItemHandler, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { query, } from "@lookiero/messaging";
|
|
2
|
+
const VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "view_booked_size_change_product_variants_for_checkout_item";
|
|
3
|
+
const viewBookedSizeChangeProductsVariantsForCheckoutItem = (payload) => ({
|
|
4
|
+
...query({ name: VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM }),
|
|
5
|
+
...payload,
|
|
6
|
+
});
|
|
7
|
+
const viewBookedSizeChangeProductsVariantsForCheckoutItemHandler = ({ view, signal }) => async ({ checkoutItemId }) => view({ checkoutItemId, signal });
|
|
8
|
+
export { VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedSizeChangeProductsVariantsForCheckoutItem, viewBookedSizeChangeProductsVariantsForCheckoutItemHandler, };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
import { CheckoutFeedbackProjection } from "./checkoutFeedback";
|
|
3
|
+
declare const VIEW_CHECKOUT_FEEDBACK_BY_CHECKOUT_ID = "view_checkout_feedback_by_checkout_id";
|
|
4
|
+
interface ViewCheckoutFeedbackByCheckoutIdPayload {
|
|
5
|
+
readonly checkoutId: string;
|
|
6
|
+
}
|
|
7
|
+
interface ViewCheckoutFeedbackByCheckoutId extends Query<typeof VIEW_CHECKOUT_FEEDBACK_BY_CHECKOUT_ID>, ViewCheckoutFeedbackByCheckoutIdPayload {
|
|
8
|
+
}
|
|
9
|
+
interface ViewCheckoutFeedbackByCheckoutIdFunction {
|
|
10
|
+
(payload: ViewCheckoutFeedbackByCheckoutIdPayload): ViewCheckoutFeedbackByCheckoutId;
|
|
11
|
+
}
|
|
12
|
+
declare const viewCheckoutFeedbackByCheckoutId: ViewCheckoutFeedbackByCheckoutIdFunction;
|
|
13
|
+
type ViewCheckoutFeedbackByCheckoutIdResult = CheckoutFeedbackProjection | null;
|
|
14
|
+
interface CheckoutFeedbackByCheckoutIdViewArgs extends CancelableQueryViewArgs {
|
|
15
|
+
readonly checkoutId: string;
|
|
16
|
+
}
|
|
17
|
+
interface CheckoutFeedbackByCheckoutIdView {
|
|
18
|
+
(args: CheckoutFeedbackByCheckoutIdViewArgs): Promise<ViewCheckoutFeedbackByCheckoutIdResult>;
|
|
19
|
+
}
|
|
20
|
+
interface ViewCheckoutFeedbackByCheckoutIdHandlerFunctionArgs extends QueryHandlerFunctionArgs {
|
|
21
|
+
readonly view: CheckoutFeedbackByCheckoutIdView;
|
|
22
|
+
}
|
|
23
|
+
declare const viewCheckoutFeedbackByCheckoutIdHandler: QueryHandlerFunction<ViewCheckoutFeedbackByCheckoutId, ViewCheckoutFeedbackByCheckoutIdResult, ViewCheckoutFeedbackByCheckoutIdHandlerFunctionArgs>;
|
|
24
|
+
export type { ViewCheckoutFeedbackByCheckoutId, CheckoutFeedbackByCheckoutIdView, ViewCheckoutFeedbackByCheckoutIdResult, };
|
|
25
|
+
export { VIEW_CHECKOUT_FEEDBACK_BY_CHECKOUT_ID, viewCheckoutFeedbackByCheckoutId, viewCheckoutFeedbackByCheckoutIdHandler, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { query, } from "@lookiero/messaging";
|
|
2
|
+
const VIEW_CHECKOUT_FEEDBACK_BY_CHECKOUT_ID = "view_checkout_feedback_by_checkout_id";
|
|
3
|
+
const viewCheckoutFeedbackByCheckoutId = (payload) => ({
|
|
4
|
+
...query({ name: VIEW_CHECKOUT_FEEDBACK_BY_CHECKOUT_ID }),
|
|
5
|
+
...payload,
|
|
6
|
+
});
|
|
7
|
+
const viewCheckoutFeedbackByCheckoutIdHandler = ({ view, signal }) => async ({ checkoutId }) => view({ checkoutId, signal });
|
|
8
|
+
export { VIEW_CHECKOUT_FEEDBACK_BY_CHECKOUT_ID, viewCheckoutFeedbackByCheckoutId, viewCheckoutFeedbackByCheckoutIdHandler, };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BootstrapDefinition } from "@lookiero/messaging";
|
|
1
2
|
import { BuildBootstrapFunctionReturn } from "@lookiero/messaging-react";
|
|
2
3
|
import { NotificationDto } from "../persistence/notificationDto";
|
|
3
4
|
import { Storage } from "../persistence/storage";
|
|
@@ -9,5 +10,12 @@ interface BootstrapFunction {
|
|
|
9
10
|
(args: BootstrapFunctionArgs): BuildBootstrapFunctionReturn;
|
|
10
11
|
}
|
|
11
12
|
declare const bootstrap: BootstrapFunction;
|
|
13
|
+
interface BootstrapWithBuilderFunctionArgs extends BootstrapFunctionArgs {
|
|
14
|
+
readonly messaging: BootstrapDefinition<BuildBootstrapFunctionReturn>;
|
|
15
|
+
}
|
|
16
|
+
interface BootstrapWithBuilderFunction {
|
|
17
|
+
(args: BootstrapWithBuilderFunctionArgs): BootstrapDefinition<BuildBootstrapFunctionReturn>;
|
|
18
|
+
}
|
|
19
|
+
declare const bootstrapWithBuilder: BootstrapWithBuilderFunction;
|
|
12
20
|
export type { BootstrapFunctionArgs };
|
|
13
|
-
export { NOTIFICATIONS_MESSAGING_CONTEXT_ID, bootstrap };
|
|
21
|
+
export { NOTIFICATIONS_MESSAGING_CONTEXT_ID, bootstrap, bootstrapWithBuilder };
|
|
@@ -11,4 +11,8 @@ const bootstrap = ({ storage }) => messagingReactBootstrap({ id: NOTIFICATIONS_M
|
|
|
11
11
|
.command(CREATE_NOTIFICATION, createNotificationHandler)(getNotification, saveNotification, { storage })
|
|
12
12
|
.command(REMOVE_NOTIFICATION, removeNotificationHandler)(getNotification, saveNotification, { storage })
|
|
13
13
|
.build();
|
|
14
|
-
|
|
14
|
+
const bootstrapWithBuilder = ({ storage, messaging }) => messaging
|
|
15
|
+
.query(LIST_NOTIFICATIONS, listNotificationsHandler, { view: storageListNotificationsView({ storage }) })
|
|
16
|
+
.command(CREATE_NOTIFICATION, createNotificationHandler)(getNotification, saveNotification, { storage })
|
|
17
|
+
.command(REMOVE_NOTIFICATION, removeNotificationHandler)(getNotification, saveNotification, { storage });
|
|
18
|
+
export { NOTIFICATIONS_MESSAGING_CONTEXT_ID, bootstrap, bootstrapWithBuilder };
|
|
@@ -9,8 +9,11 @@ interface CreateNotificationFunctionArgs {
|
|
|
9
9
|
interface CreateNotificationFunction {
|
|
10
10
|
(args: CreateNotificationFunctionArgs): Promise<void>;
|
|
11
11
|
}
|
|
12
|
+
interface UseCreateNotificationFunctionArgs {
|
|
13
|
+
readonly contextId: string;
|
|
14
|
+
}
|
|
12
15
|
interface UseCreateNotificationFunction {
|
|
13
|
-
(): [create: CreateNotificationFunction, status: CommandStatus];
|
|
16
|
+
(args: UseCreateNotificationFunctionArgs): [create: CreateNotificationFunction, status: CommandStatus];
|
|
14
17
|
}
|
|
15
18
|
declare const useCreateNotification: UseCreateNotificationFunction;
|
|
16
19
|
export { useCreateNotification };
|
package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js
CHANGED
|
@@ -2,9 +2,8 @@ import { useCommand } from "@lookiero/messaging-react";
|
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { v4 as uuid } from "uuid";
|
|
4
4
|
import { createNotification } from "../../../../domain/notification/command/createNotification";
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const [commandBus, status] = useCommand({ contextId: NOTIFICATIONS_MESSAGING_CONTEXT_ID });
|
|
5
|
+
const useCreateNotification = ({ contextId }) => {
|
|
6
|
+
const [commandBus, status] = useCommand({ contextId });
|
|
8
7
|
const create = useCallback(({ aggregateId, level, titleI18nKey, bodyI18nKey }) => commandBus(createNotification({
|
|
9
8
|
aggregateId: aggregateId || uuid(),
|
|
10
9
|
level,
|
|
@@ -5,8 +5,11 @@ interface RemoveNotificationFunctionArgs {
|
|
|
5
5
|
interface RemoveNotificationFunction {
|
|
6
6
|
(args: RemoveNotificationFunctionArgs): Promise<void>;
|
|
7
7
|
}
|
|
8
|
+
interface UseRemoveNotificationFunctionArgs {
|
|
9
|
+
readonly contextId: string;
|
|
10
|
+
}
|
|
8
11
|
interface UseRemoveNotificationFunction {
|
|
9
|
-
(): [remove: RemoveNotificationFunction, status: CommandStatus];
|
|
12
|
+
(args: UseRemoveNotificationFunctionArgs): [remove: RemoveNotificationFunction, status: CommandStatus];
|
|
10
13
|
}
|
|
11
14
|
declare const useRemoveNotification: UseRemoveNotificationFunction;
|
|
12
15
|
export { useRemoveNotification };
|
package/dist/shared/notifications/infrastructure/domain/notification/react/useRemoveNotification.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useCommand } from "@lookiero/messaging-react";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { removeNotification } from "../../../../domain/notification/command/removeNotification";
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const [commandBus, status] = useCommand({ contextId: NOTIFICATIONS_MESSAGING_CONTEXT_ID });
|
|
4
|
+
const useRemoveNotification = ({ contextId }) => {
|
|
5
|
+
const [commandBus, status] = useCommand({ contextId });
|
|
7
6
|
const remove = useCallback(({ aggregateId }) => commandBus(removeNotification({ aggregateId })), [commandBus]);
|
|
8
7
|
return [remove, status];
|
|
9
8
|
};
|
|
@@ -2,9 +2,9 @@ import React, { useCallback } from "react";
|
|
|
2
2
|
import { useListNotifications } from "../../../projection/notification/react/useListNotifications";
|
|
3
3
|
import { useRemoveNotification } from "../../domain/notification/react/useRemoveNotification";
|
|
4
4
|
import { Notifications as NotificationsTemplate } from "../components/Notifications";
|
|
5
|
-
const Notifications = () => {
|
|
6
|
-
const [notifications] = useListNotifications();
|
|
7
|
-
const [remove] = useRemoveNotification();
|
|
5
|
+
const Notifications = ({ contextId }) => {
|
|
6
|
+
const [notifications] = useListNotifications({ contextId });
|
|
7
|
+
const [remove] = useRemoveNotification({ contextId });
|
|
8
8
|
const onRemove = useCallback((id) => remove({ aggregateId: id }), [remove]);
|
|
9
9
|
return React.createElement(NotificationsTemplate, { notifications: notifications, onRemove: onRemove });
|
|
10
10
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
2
|
import { ListNotificationsResult } from "../listNotifications";
|
|
3
|
+
interface UseListNotificationsFunctionArgs {
|
|
4
|
+
readonly contextId: string;
|
|
5
|
+
}
|
|
3
6
|
interface UseListNotificationsFunction {
|
|
4
|
-
(): UseQueryFunctionResult<ListNotificationsResult>;
|
|
7
|
+
(args: UseListNotificationsFunctionArgs): UseQueryFunctionResult<ListNotificationsResult>;
|
|
5
8
|
}
|
|
6
9
|
declare const useListNotifications: UseListNotificationsFunction;
|
|
7
10
|
export { useListNotifications };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { useQuery } from "@lookiero/messaging-react";
|
|
2
2
|
import { NOTIFICATION_CREATED } from "../../../domain/notification/model/notificationCreated";
|
|
3
3
|
import { NOTIFICATION_REMOVED } from "../../../domain/notification/model/notificationRemoved";
|
|
4
|
-
import { NOTIFICATIONS_MESSAGING_CONTEXT_ID } from "../../../infrastructure/delivery/bootstrap";
|
|
5
4
|
import { listNotifications } from "../listNotifications";
|
|
6
5
|
const isNotificationCreated = (event) => event.name === NOTIFICATION_CREATED;
|
|
7
6
|
const isNotificationRemoved = (event) => event.name === NOTIFICATION_REMOVED;
|
|
8
7
|
const shouldInvalidate = (event) => isNotificationCreated(event) || isNotificationRemoved(event);
|
|
9
|
-
const useListNotifications = () => useQuery({
|
|
8
|
+
const useListNotifications = ({ contextId }) => useQuery({
|
|
10
9
|
query: listNotifications(),
|
|
11
|
-
contextId
|
|
10
|
+
contextId,
|
|
12
11
|
invalidation: shouldInvalidate,
|
|
13
12
|
options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
14
13
|
});
|
|
@@ -23,7 +23,7 @@ const Field = ({ label, isFocused = false, style: customStyle }) => {
|
|
|
23
23
|
},
|
|
24
24
|
customStyle?.field,
|
|
25
25
|
] },
|
|
26
|
-
React.createElement(Text, { level: 1, style: [style.fieldText, customStyle?.fieldText], detail: true }, label),
|
|
26
|
+
React.createElement(Text, { level: 1, numberOfLines: 1, style: [style.fieldText, customStyle?.fieldText], detail: true }, label),
|
|
27
27
|
React.createElement(View, { style: [style.fieldBackground, { opacity: isFocused ? 1 : 0 }] })));
|
|
28
28
|
};
|
|
29
29
|
export { Field };
|
|
@@ -32,6 +32,6 @@ const Input = ({ minHeight = MIN_HEIGHT, maxHeight = MAX_HEIGHT, style: customSt
|
|
|
32
32
|
}, [maxHeight, minHeight, multiline]);
|
|
33
33
|
useLayoutEffect(handleOnContentSizeChangeWeb, [handleOnContentSizeChangeWeb, value]);
|
|
34
34
|
const textInputRef = useRef(null);
|
|
35
|
-
return (React.createElement(TextInput, { ...restOfProps, ref: textInputRef, multiline: multiline, placeholderTextColor: placeholderTextColor, style: [style.input, customStyle, { height }], testID: "input", textAlignVertical: "top", value: value, onChange: onChange, onContentSizeChange: handleOnContentSizeChange }));
|
|
35
|
+
return (React.createElement(TextInput, { ...restOfProps, ref: textInputRef, multiline: multiline, numberOfLines: !!multiline ? undefined : 1, placeholderTextColor: placeholderTextColor, style: [style.input, customStyle, { height }], testID: "input", textAlignVertical: "top", value: value, onChange: onChange, onContentSizeChange: handleOnContentSizeChange }));
|
|
36
36
|
};
|
|
37
37
|
export { Input };
|
|
@@ -8,12 +8,9 @@ declare const style: {
|
|
|
8
8
|
fontFamily: string;
|
|
9
9
|
fontSize: number;
|
|
10
10
|
letterSpacing: number;
|
|
11
|
-
outlineStyle: string;
|
|
12
11
|
paddingBottom: number;
|
|
13
12
|
paddingHorizontal: number;
|
|
14
13
|
paddingTop: number;
|
|
15
|
-
textOverflow: string;
|
|
16
|
-
whiteSpace: string;
|
|
17
14
|
};
|
|
18
15
|
};
|
|
19
16
|
export { style, borderSize, paddingVertical };
|
|
@@ -10,12 +10,12 @@ const style = StyleSheet.create({
|
|
|
10
10
|
fontFamily: fontMap.Body,
|
|
11
11
|
fontSize: fontBodySize3,
|
|
12
12
|
letterSpacing: fontBodyLetterSpacing3,
|
|
13
|
-
outlineStyle: "none",
|
|
13
|
+
// outlineStyle: "none",
|
|
14
14
|
paddingBottom: paddingVertical,
|
|
15
15
|
paddingHorizontal: spaceM,
|
|
16
16
|
paddingTop: paddingVertical,
|
|
17
|
-
textOverflow: "ellipsis",
|
|
18
|
-
whiteSpace: "nowrap",
|
|
17
|
+
// textOverflow: "ellipsis",
|
|
18
|
+
// whiteSpace: "nowrap",
|
|
19
19
|
...Platform.select({
|
|
20
20
|
web: {
|
|
21
21
|
lineHeight: fontBodyHeight3,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
declare const style: StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
|
|
3
3
|
sticky: {
|
|
4
|
+
zIndex: number;
|
|
4
5
|
backgroundColor: string;
|
|
5
6
|
bottom: number;
|
|
6
7
|
elevation: number;
|
|
@@ -14,6 +15,7 @@ declare const style: StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
|
|
|
14
15
|
shadowRadius: number;
|
|
15
16
|
width: string;
|
|
16
17
|
} | {
|
|
18
|
+
zIndex: number;
|
|
17
19
|
position: "sticky";
|
|
18
20
|
backgroundColor: string;
|
|
19
21
|
bottom: number;
|
|
@@ -28,6 +30,7 @@ declare const style: StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
|
|
|
28
30
|
shadowRadius: number;
|
|
29
31
|
width: string;
|
|
30
32
|
} | {
|
|
33
|
+
zIndex: number;
|
|
31
34
|
position: "absolute";
|
|
32
35
|
backgroundColor: string;
|
|
33
36
|
bottom: number;
|
|
@@ -18,16 +18,11 @@ const style = StyleSheet.create({
|
|
|
18
18
|
shadowRadius: elevationRadius,
|
|
19
19
|
width: "100%",
|
|
20
20
|
...Platform.select({
|
|
21
|
-
web: {
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
ios: {
|
|
25
|
-
position: "absolute",
|
|
26
|
-
},
|
|
27
|
-
android: {
|
|
28
|
-
position: "absolute",
|
|
29
|
-
},
|
|
21
|
+
web: { position: "sticky" },
|
|
22
|
+
ios: { position: "absolute" },
|
|
23
|
+
android: { position: "absolute" },
|
|
30
24
|
}),
|
|
25
|
+
zIndex: 0,
|
|
31
26
|
},
|
|
32
27
|
});
|
|
33
28
|
export { style };
|
|
@@ -8,6 +8,7 @@ import { Input } from "../../atoms/input/Input";
|
|
|
8
8
|
import { style } from "./InputField.style";
|
|
9
9
|
const { colorBase, colorContent, colorGrayscaleL, colorPrimary, spaceM, iconSize } = theme();
|
|
10
10
|
const inputPaddingRightWithIcon = iconSize + spaceM * 2;
|
|
11
|
+
const inputPaddingRightWithoutIcon = spaceM * 2;
|
|
11
12
|
const InputField = ({ label, placeholder, value, multiline = false, minHeight, error, style: customStyle, onChange = () => void 0, icon, ...inputRestProps }) => {
|
|
12
13
|
const [isFocused, setIsFocused] = useState(false);
|
|
13
14
|
const handleOnChange = useCallback((text) => onChange(text), [onChange]);
|
|
@@ -17,7 +18,11 @@ const InputField = ({ label, placeholder, value, multiline = false, minHeight, e
|
|
|
17
18
|
return (React.createElement(View, { style: customStyle?.inputField, testID: "input-field" },
|
|
18
19
|
React.createElement(Field, { isFocused: isFocused || !!value, label: label, style: {
|
|
19
20
|
field: [style.field, customStyle?.field],
|
|
20
|
-
fieldText: [
|
|
21
|
+
fieldText: [
|
|
22
|
+
{ color },
|
|
23
|
+
{ paddingRight: !!icon ? inputPaddingRightWithIcon : inputPaddingRightWithoutIcon },
|
|
24
|
+
customStyle?.fieldText,
|
|
25
|
+
],
|
|
21
26
|
} }),
|
|
22
27
|
React.createElement(Input, { minHeight: minHeight, multiline: multiline, placeholder: placeholder, placeholderTextColor: isFocused ? colorGrayscaleL : colorBase, style: [!!icon && { paddingRight: inputPaddingRightWithIcon }, { borderColor: color }, customStyle?.input], value: value, onBlur: handleOnBlur, onChangeText: handleOnChange, onFocus: handleOnFocus, ...inputRestProps }),
|
|
23
28
|
!!icon && React.createElement(Icon, { name: icon, style: [style.icon, { color }, customStyle?.icon] }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6-beta.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"react": "^18.0.0",
|
|
54
54
|
"react-dom": "^18.0.0",
|
|
55
55
|
"react-native": "^0.70.6",
|
|
56
|
+
"react-native-get-random-values": "^1.8.0",
|
|
56
57
|
"react-native-web": "^0.18.9",
|
|
57
58
|
"react-router-dom": "^6.4.5",
|
|
58
59
|
"react-router-native": "^6.4.5"
|