@lookiero/checkout 4.0.0 → 4.0.1-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.
Files changed (96) hide show
  1. package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.d.ts +6 -0
  2. package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.js +13 -0
  3. package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.d.ts +10 -0
  4. package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.js +11 -0
  5. package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.d.ts +6 -0
  6. package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.js +7 -0
  7. package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.d.ts +6 -0
  8. package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.js +9 -0
  9. package/dist/infrastructure/ui/Root.d.ts +2 -0
  10. package/dist/infrastructure/ui/Root.js +2 -2
  11. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.d.ts +13 -0
  12. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +19 -0
  13. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.d.ts +6 -0
  14. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.js +7 -0
  15. package/dist/infrastructure/ui/components/templates/header/header/Header.d.ts +3 -0
  16. package/dist/infrastructure/ui/components/templates/header/header/Header.js +10 -0
  17. package/dist/infrastructure/ui/components/templates/header/header/Header.style.d.ts +9 -0
  18. package/dist/infrastructure/ui/components/templates/header/header/Header.style.js +12 -0
  19. package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.d.ts +13 -0
  20. package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.js +19 -0
  21. package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.style.ts.d.ts +6 -0
  22. package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.style.ts.js +7 -0
  23. package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.d.ts +2 -0
  24. package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.js +28 -0
  25. package/dist/infrastructure/ui/hooks/useToast.d.ts +11 -0
  26. package/dist/infrastructure/ui/hooks/useToast.js +49 -0
  27. package/dist/infrastructure/ui/routing/Routing.d.ts +2 -0
  28. package/dist/infrastructure/ui/routing/Routing.js +2 -2
  29. package/dist/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.d.ts +2 -0
  30. package/dist/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +6 -5
  31. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.d.ts +7 -0
  32. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.js +25 -0
  33. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.d.ts +16 -0
  34. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.js +19 -0
  35. package/dist/infrastructure/ui/views/intro/Intro.d.ts +6 -0
  36. package/dist/infrastructure/ui/views/intro/Intro.js +52 -0
  37. package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +52 -0
  38. package/dist/infrastructure/ui/views/intro/Intro.style.js +55 -0
  39. package/dist/infrastructure/ui/views/item/Item.style.d.ts +15 -0
  40. package/dist/infrastructure/ui/views/item/Item.style.js +18 -0
  41. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.d.ts +26 -0
  42. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +44 -0
  43. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.d.ts +45 -0
  44. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.js +53 -0
  45. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.d.ts +7 -0
  46. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.js +25 -0
  47. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.d.ts +16 -0
  48. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.js +19 -0
  49. package/dist/infrastructure/ui/views/navigation/Navigation.d.ts +21 -0
  50. package/dist/infrastructure/ui/views/navigation/Navigation.js +45 -0
  51. package/dist/infrastructure/ui/views/navigation/Navigation.style.d.ts +5 -0
  52. package/dist/infrastructure/ui/views/navigation/Navigation.style.js +30 -0
  53. package/dist/infrastructure/ui/views/navigation/components/header/Header.d.ts +46 -0
  54. package/dist/infrastructure/ui/views/navigation/components/header/Header.js +120 -0
  55. package/dist/infrastructure/ui/views/navigation/components/header/Header.style.d.ts +31 -0
  56. package/dist/infrastructure/ui/views/navigation/components/header/Header.style.js +34 -0
  57. package/dist/infrastructure/ui/views/navigation/components/header/Logo.d.ts +7 -0
  58. package/dist/infrastructure/ui/views/navigation/components/header/Logo.js +11 -0
  59. package/dist/infrastructure/ui/views/navigation/components/header/Logo.style.d.ts +7 -0
  60. package/dist/infrastructure/ui/views/navigation/components/header/Logo.style.js +8 -0
  61. package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.d.ts +12 -0
  62. package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js +24 -0
  63. package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.d.ts +15 -0
  64. package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.js +18 -0
  65. package/dist/projection/shared/subscription.d.ts +2 -0
  66. package/dist/projection/shared/subscription.js +1 -0
  67. package/dist/shared/notifications/domain/notification/command/createNotification.d.ts +17 -0
  68. package/dist/shared/notifications/domain/notification/command/createNotification.js +7 -0
  69. package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.d.ts +21 -0
  70. package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js +22 -0
  71. package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.d.ts +12 -0
  72. package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.js +24 -0
  73. package/dist/shared/notifications/infrastructure/ui/components/Notifications.d.ts +9 -0
  74. package/dist/shared/notifications/infrastructure/ui/components/Notifications.js +20 -0
  75. package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.d.ts +36 -0
  76. package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.js +31 -0
  77. package/dist/shared/tracking/infrastructure/usePageView.d.ts +13 -0
  78. package/dist/shared/tracking/infrastructure/usePageView.js +27 -0
  79. package/dist/shared/tracking/infrastructure/useTrackCheckout.d.ts +6 -4
  80. package/dist/shared/tracking/infrastructure/useTrackCheckout.js +13 -8
  81. package/dist/shared/tracking/tracking.d.ts +11 -5
  82. package/dist/shared/ui/components/atoms/error/Error.style.d.ts +6 -0
  83. package/dist/shared/ui/components/atoms/error/Error.style.js +9 -0
  84. package/dist/shared/ui/components/layouts/slider/Bullets.d.ts +10 -0
  85. package/dist/shared/ui/components/layouts/slider/Bullets.js +29 -0
  86. package/dist/shared/ui/components/layouts/slider/Bullets.style.d.ts +12 -0
  87. package/dist/shared/ui/components/layouts/slider/Bullets.style.js +15 -0
  88. package/dist/shared/ui/components/layouts/slider/Pagination.d.ts +14 -0
  89. package/dist/shared/ui/components/layouts/slider/Pagination.js +11 -0
  90. package/dist/shared/ui/components/layouts/slider/Pagination.style.d.ts +23 -0
  91. package/dist/shared/ui/components/layouts/slider/Pagination.style.js +27 -0
  92. package/dist/shared/ui/components/layouts/slider/Slider.d.ts +15 -0
  93. package/dist/shared/ui/components/layouts/slider/Slider.js +132 -0
  94. package/dist/shared/ui/components/layouts/slider/Slider.style.d.ts +11 -0
  95. package/dist/shared/ui/components/layouts/slider/Slider.style.js +12 -0
  96. package/package.json +1 -1
@@ -0,0 +1,14 @@
1
+ import { FC, ReactNode } from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ interface PaginationProps {
4
+ readonly touchable?: boolean;
5
+ readonly paginationStyle?: StyleProp<ViewStyle>;
6
+ readonly paginationItemStyle?: StyleProp<ViewStyle>;
7
+ readonly paginationActiveItemStyle?: StyleProp<ViewStyle>;
8
+ readonly count?: number;
9
+ readonly activeIndex?: number;
10
+ readonly onChange: (index: number) => void;
11
+ readonly renderItem?: (index: number) => ReactNode;
12
+ }
13
+ declare const Pagination: FC<PaginationProps>;
14
+ export { Pagination };
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { Pressable, View } from "react-native";
3
+ import { style } from "./Pagination.style";
4
+ const Pagination = ({ touchable = true, paginationStyle, paginationItemStyle, paginationActiveItemStyle, count = 0, activeIndex = 0, renderItem, onChange, }) => (React.createElement(View, { style: [style.paginationWrapper, paginationStyle], testID: "slider-pagination" }, Array.from(Array(count).keys()).map((index) => (React.createElement(View, { key: index, style: style.paginationContainer },
5
+ React.createElement(Pressable, { testID: "slider-pagination-item", style: [
6
+ style.paginationItem,
7
+ activeIndex === index && style.active,
8
+ paginationItemStyle,
9
+ activeIndex === index && paginationActiveItemStyle,
10
+ ], onPress: !touchable ? undefined : () => onChange(index) }, renderItem?.(index)))))));
11
+ export { Pagination };
@@ -0,0 +1,23 @@
1
+ declare const style: {
2
+ active: {
3
+ backgroundColor: string;
4
+ };
5
+ paginationContainer: {
6
+ margin: number;
7
+ };
8
+ paginationItem: {
9
+ backgroundColor: string;
10
+ borderRadius: number;
11
+ height: number;
12
+ width: number;
13
+ };
14
+ paginationWrapper: {
15
+ alignItems: "center";
16
+ bottom: number;
17
+ flexDirection: "row";
18
+ justifyContent: "center";
19
+ position: "absolute";
20
+ width: string;
21
+ };
22
+ };
23
+ export { style };
@@ -0,0 +1,27 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "../../../../../infrastructure/ui/theme/theme";
3
+ const { colorGrayscaleS, colorGrayscaleXL } = theme();
4
+ const DOT_SIZE = 8;
5
+ const style = StyleSheet.create({
6
+ active: {
7
+ backgroundColor: colorGrayscaleXL,
8
+ },
9
+ paginationContainer: {
10
+ margin: 3,
11
+ },
12
+ paginationItem: {
13
+ backgroundColor: colorGrayscaleS,
14
+ borderRadius: DOT_SIZE / 2,
15
+ height: DOT_SIZE,
16
+ width: DOT_SIZE,
17
+ },
18
+ paginationWrapper: {
19
+ alignItems: "center",
20
+ bottom: 10,
21
+ flexDirection: "row",
22
+ justifyContent: "center",
23
+ position: "absolute",
24
+ width: "100%",
25
+ },
26
+ });
27
+ export { style };
@@ -0,0 +1,15 @@
1
+ import { FC, ReactNode } from "react";
2
+ interface SliderProps {
3
+ readonly children: ReactNode[];
4
+ readonly active?: number;
5
+ readonly loop?: boolean;
6
+ readonly minDistanceToCapture?: number;
7
+ readonly minDistanceForAction?: number;
8
+ readonly gesturesEnabled?: boolean;
9
+ readonly paginationEnabled?: boolean;
10
+ readonly onSliderStart?: () => void;
11
+ readonly onSliderEnd?: () => void;
12
+ readonly onChanged?: (index: number) => void;
13
+ }
14
+ declare const Slider: FC<SliderProps>;
15
+ export { Slider };
@@ -0,0 +1,132 @@
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 };
@@ -0,0 +1,11 @@
1
+ declare const style: {
2
+ container: {
3
+ flex: number;
4
+ overflow: "hidden";
5
+ };
6
+ sliderAreaStyle: {
7
+ flex: number;
8
+ flexDirection: "row";
9
+ };
10
+ };
11
+ export { style };
@@ -0,0 +1,12 @@
1
+ import { StyleSheet } from "react-native";
2
+ const style = StyleSheet.create({
3
+ container: {
4
+ flex: 1,
5
+ overflow: "hidden",
6
+ },
7
+ sliderAreaStyle: {
8
+ flex: 1,
9
+ flexDirection: "row",
10
+ },
11
+ });
12
+ export { style };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "4.0.0",
3
+ "version": "4.0.1-beta.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [