@lookiero/checkout 4.0.1-beta.1 → 4.0.2
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/shared/tracking/infrastructure/useTrackCheckout.js +10 -8
- package/dist/shared/tracking/tracking.d.ts +10 -8
- package/package.json +1 -1
- package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.d.ts +0 -6
- package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.js +0 -13
- package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.d.ts +0 -10
- package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.js +0 -11
- package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.d.ts +0 -6
- package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.js +0 -7
- package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.d.ts +0 -6
- package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.js +0 -9
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.d.ts +0 -13
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +0 -19
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.d.ts +0 -6
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.js +0 -7
- package/dist/infrastructure/ui/components/templates/header/header/Header.d.ts +0 -3
- package/dist/infrastructure/ui/components/templates/header/header/Header.js +0 -10
- package/dist/infrastructure/ui/components/templates/header/header/Header.style.d.ts +0 -9
- package/dist/infrastructure/ui/components/templates/header/header/Header.style.js +0 -12
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.d.ts +0 -13
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.js +0 -19
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.style.ts.d.ts +0 -6
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.style.ts.js +0 -7
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.d.ts +0 -2
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.js +0 -28
- package/dist/infrastructure/ui/hooks/useToast.d.ts +0 -11
- package/dist/infrastructure/ui/hooks/useToast.js +0 -49
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.d.ts +0 -7
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.js +0 -25
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.d.ts +0 -16
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.js +0 -19
- package/dist/infrastructure/ui/views/intro/Intro.d.ts +0 -6
- package/dist/infrastructure/ui/views/intro/Intro.js +0 -52
- package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +0 -52
- package/dist/infrastructure/ui/views/intro/Intro.style.js +0 -55
- package/dist/infrastructure/ui/views/item/Item.style.d.ts +0 -15
- package/dist/infrastructure/ui/views/item/Item.style.js +0 -18
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.d.ts +0 -26
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +0 -44
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.d.ts +0 -45
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.js +0 -53
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.d.ts +0 -7
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.js +0 -25
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.d.ts +0 -16
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.js +0 -19
- package/dist/infrastructure/ui/views/navigation/Navigation.d.ts +0 -21
- package/dist/infrastructure/ui/views/navigation/Navigation.js +0 -45
- package/dist/infrastructure/ui/views/navigation/Navigation.style.d.ts +0 -5
- package/dist/infrastructure/ui/views/navigation/Navigation.style.js +0 -30
- package/dist/infrastructure/ui/views/navigation/components/header/Header.d.ts +0 -46
- package/dist/infrastructure/ui/views/navigation/components/header/Header.js +0 -120
- package/dist/infrastructure/ui/views/navigation/components/header/Header.style.d.ts +0 -31
- package/dist/infrastructure/ui/views/navigation/components/header/Header.style.js +0 -34
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.d.ts +0 -7
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.js +0 -11
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.style.d.ts +0 -7
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.style.js +0 -8
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.d.ts +0 -12
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js +0 -24
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.d.ts +0 -15
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.js +0 -18
- package/dist/shared/notifications/domain/notification/command/createNotification.d.ts +0 -17
- package/dist/shared/notifications/domain/notification/command/createNotification.js +0 -7
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.d.ts +0 -21
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js +0 -22
- package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.d.ts +0 -12
- package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.js +0 -24
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.d.ts +0 -9
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.js +0 -20
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.d.ts +0 -36
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.js +0 -31
- package/dist/shared/tracking/infrastructure/usePageView.d.ts +0 -13
- package/dist/shared/tracking/infrastructure/usePageView.js +0 -27
- package/dist/shared/ui/components/atoms/error/Error.style.d.ts +0 -6
- package/dist/shared/ui/components/atoms/error/Error.style.js +0 -9
- package/dist/shared/ui/components/layouts/slider/Bullets.d.ts +0 -10
- package/dist/shared/ui/components/layouts/slider/Bullets.js +0 -29
- package/dist/shared/ui/components/layouts/slider/Bullets.style.d.ts +0 -12
- package/dist/shared/ui/components/layouts/slider/Bullets.style.js +0 -15
- package/dist/shared/ui/components/layouts/slider/Pagination.d.ts +0 -14
- package/dist/shared/ui/components/layouts/slider/Pagination.js +0 -11
- package/dist/shared/ui/components/layouts/slider/Pagination.style.d.ts +0 -23
- package/dist/shared/ui/components/layouts/slider/Pagination.style.js +0 -27
- package/dist/shared/ui/components/layouts/slider/Slider.d.ts +0 -15
- package/dist/shared/ui/components/layouts/slider/Slider.js +0 -132
- package/dist/shared/ui/components/layouts/slider/Slider.style.d.ts +0 -11
- package/dist/shared/ui/components/layouts/slider/Slider.style.js +0 -12
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
-
import { Animated, I18nManager, PanResponder, StyleSheet, View } from "react-native";
|
|
3
|
-
import { Bullets } from "./Bullets";
|
|
4
|
-
import { style } from "./Slider.style";
|
|
5
|
-
const DEFAULT_WIDTH = 200;
|
|
6
|
-
const Slider = ({ children, active = 0, loop = false, minDistanceToCapture = 5, minDistanceForAction = 0.2, gesturesEnabled = true, paginationEnabled = true, onSliderStart, onSliderEnd, onChanged, }) => {
|
|
7
|
-
const flatennedChildren = children.flat();
|
|
8
|
-
const count = flatennedChildren.length;
|
|
9
|
-
const [width, setWidth] = useState(0);
|
|
10
|
-
const widthRef = useRef(width);
|
|
11
|
-
const activeIndex = useRef(active);
|
|
12
|
-
const animatedValueX = useRef(0);
|
|
13
|
-
const animatedValueY = useRef(0);
|
|
14
|
-
const pan = useRef(new Animated.ValueXY()).current;
|
|
15
|
-
const started = useRef(false);
|
|
16
|
-
const panResponder = useRef(PanResponder.create({
|
|
17
|
-
onPanResponderTerminationRequest: () => false,
|
|
18
|
-
onMoveShouldSetPanResponder: () => gesturesEnabled,
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
20
|
-
onMoveShouldSetPanResponderCapture: (_e, gestureState) => {
|
|
21
|
-
if (!gesturesEnabled) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
startAnimation();
|
|
25
|
-
const allow = Math.abs(gestureState.dx) > minDistanceToCapture;
|
|
26
|
-
return allow;
|
|
27
|
-
},
|
|
28
|
-
onPanResponderGrant: () => fixState(),
|
|
29
|
-
onPanResponderMove: Animated.event([null, { dx: pan.x }], {
|
|
30
|
-
useNativeDriver: false,
|
|
31
|
-
}),
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
33
|
-
onPanResponderRelease: (_e, gesture) => {
|
|
34
|
-
const correction = gesture.moveX - gesture.x0;
|
|
35
|
-
if (Math.abs(correction) < widthRef.current * minDistanceForAction) {
|
|
36
|
-
spring({ x: 0, y: 0 });
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
changeIndex(correction > 0 ? (I18nManager.isRTL ? 1 : -1) : I18nManager.isRTL ? -1 : 1);
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
onPanResponderEnd: () => endAnimation(),
|
|
43
|
-
})).current;
|
|
44
|
-
const startAnimation = useCallback(() => {
|
|
45
|
-
if (!started.current) {
|
|
46
|
-
onSliderStart?.();
|
|
47
|
-
started.current = true;
|
|
48
|
-
}
|
|
49
|
-
}, [onSliderStart]);
|
|
50
|
-
const endAnimation = useCallback(() => {
|
|
51
|
-
if (started.current) {
|
|
52
|
-
onSliderEnd?.();
|
|
53
|
-
started.current = false;
|
|
54
|
-
}
|
|
55
|
-
}, [onSliderEnd]);
|
|
56
|
-
const fixState = useCallback(() => {
|
|
57
|
-
animatedValueX.current = widthRef.current * activeIndex.current * (I18nManager.isRTL ? 1 : -1);
|
|
58
|
-
animatedValueY.current = 0;
|
|
59
|
-
pan.setOffset({
|
|
60
|
-
x: animatedValueX.current,
|
|
61
|
-
y: animatedValueY.current,
|
|
62
|
-
});
|
|
63
|
-
pan.setValue({ x: 0, y: 0 });
|
|
64
|
-
}, [pan]);
|
|
65
|
-
const spring = useCallback((toValue) => {
|
|
66
|
-
Animated.spring(pan, {
|
|
67
|
-
toValue,
|
|
68
|
-
useNativeDriver: false,
|
|
69
|
-
}).start();
|
|
70
|
-
}, [pan]);
|
|
71
|
-
const changeIndex = useCallback((delta = 1) => {
|
|
72
|
-
const toValue = { x: 0, y: 0 };
|
|
73
|
-
let skipChanges = !delta;
|
|
74
|
-
let calcDelta = delta;
|
|
75
|
-
if (activeIndex.current <= 0 && delta < 0) {
|
|
76
|
-
skipChanges = !loop;
|
|
77
|
-
calcDelta = count + delta;
|
|
78
|
-
}
|
|
79
|
-
else if (activeIndex.current + 1 >= count && delta > 0) {
|
|
80
|
-
skipChanges = !loop;
|
|
81
|
-
calcDelta = -1 * activeIndex.current + delta - 1;
|
|
82
|
-
}
|
|
83
|
-
if (skipChanges) {
|
|
84
|
-
return spring(toValue);
|
|
85
|
-
}
|
|
86
|
-
const index = activeIndex.current + calcDelta;
|
|
87
|
-
activeIndex.current = index;
|
|
88
|
-
toValue.x = widthRef.current * (I18nManager.isRTL ? 1 : -1) * calcDelta;
|
|
89
|
-
spring(toValue);
|
|
90
|
-
onChanged?.(index);
|
|
91
|
-
}, [count, loop, onChanged, spring]);
|
|
92
|
-
const fixAndGo = useCallback((delta) => {
|
|
93
|
-
fixState();
|
|
94
|
-
startAnimation();
|
|
95
|
-
changeIndex(delta);
|
|
96
|
-
}, [changeIndex, fixState, startAnimation]);
|
|
97
|
-
const goTo = useCallback((index = 0) => {
|
|
98
|
-
const delta = index - activeIndex.current;
|
|
99
|
-
if (delta) {
|
|
100
|
-
fixAndGo(delta);
|
|
101
|
-
}
|
|
102
|
-
}, [fixAndGo]);
|
|
103
|
-
const getActiveIndex = useCallback(() => activeIndex.current, []);
|
|
104
|
-
useEffect(() => {
|
|
105
|
-
pan.x.addListener(({ value }) => (animatedValueX.current = value));
|
|
106
|
-
pan.y.addListener(({ value }) => (animatedValueY.current = value));
|
|
107
|
-
return () => {
|
|
108
|
-
pan.x.removeAllListeners();
|
|
109
|
-
pan.y.removeAllListeners();
|
|
110
|
-
};
|
|
111
|
-
}, [pan.x, pan.y]);
|
|
112
|
-
useEffect(() => {
|
|
113
|
-
if (activeIndex.current !== active) {
|
|
114
|
-
goTo(active);
|
|
115
|
-
}
|
|
116
|
-
}, [active, goTo]);
|
|
117
|
-
const onLayoutWrapper = useCallback(({ nativeEvent: { layout: { width: wrapperWidth }, }, }) => {
|
|
118
|
-
const width = wrapperWidth || DEFAULT_WIDTH;
|
|
119
|
-
setWidth(width);
|
|
120
|
-
widthRef.current = width;
|
|
121
|
-
fixState();
|
|
122
|
-
}, [fixState]);
|
|
123
|
-
return (React.createElement(View, { style: style.container, testID: "slider", onLayout: onLayoutWrapper },
|
|
124
|
-
React.createElement(Animated.View, { style: StyleSheet.flatten([
|
|
125
|
-
{
|
|
126
|
-
left: pan.x,
|
|
127
|
-
},
|
|
128
|
-
style.sliderAreaStyle,
|
|
129
|
-
]), ...panResponder.panHandlers }, flatennedChildren.map((child, index) => (React.createElement(View, { key: index, style: { width }, testID: "slider-child" }, child)))),
|
|
130
|
-
paginationEnabled && (React.createElement(Bullets, { activeIndex: getActiveIndex(), count: count, testID: "slider-bullets", onChange: (index) => goTo(index) }))));
|
|
131
|
-
};
|
|
132
|
-
export { Slider };
|