@lookiero/checkout 8.20.0 → 8.21.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/.detoxrc.js +55 -0
- package/app.json +15 -3
- package/babel.config.js +20 -0
- package/dist/fake-dependencies/@lookiero/payments-front/index.d.ts +21 -0
- package/dist/fake-dependencies/@lookiero/payments-front/index.js +20 -0
- package/dist/src/Expo.d.ts +1 -1
- package/dist/src/Expo.js +1 -0
- package/dist/src/ExpoRoot.js +13 -31
- package/dist/src/infrastructure/delivery/bootstrap.mock.d.ts +3 -0
- package/dist/src/infrastructure/delivery/bootstrap.mock.js +91 -0
- package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.d.ts +3 -0
- package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.js +27 -0
- package/dist/src/infrastructure/projection/checkout/checkout.mock.d.ts +19 -0
- package/dist/src/infrastructure/projection/checkout/checkout.mock.js +21 -0
- package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.d.ts +3 -0
- package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.js +6 -0
- package/dist/src/infrastructure/projection/checkoutFeedback/checkoutFeedback.mock.d.ts +3 -0
- package/dist/src/infrastructure/projection/checkoutFeedback/checkoutFeedback.mock.js +5 -0
- package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.d.ts +15 -0
- package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.js +43 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.d.ts +3 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.js +103 -0
- package/dist/src/infrastructure/projection/feedback/feedback.mock.d.ts +3 -0
- package/dist/src/infrastructure/projection/feedback/feedback.mock.js +6 -0
- package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.d.ts +6 -0
- package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.js +183 -0
- package/dist/src/infrastructure/projection/pricing/pricing.mock.d.ts +9 -0
- package/dist/src/infrastructure/projection/pricing/pricing.mock.js +42 -0
- package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.d.ts +3 -0
- package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +354 -0
- package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +11 -1
- package/dist/src/infrastructure/ui/views/checkout/Checkout.js +1 -1
- package/dist/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js +2 -2
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +2 -1
- package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.js +1 -1
- package/dist/src/infrastructure/ui/views/summary/Summary.js +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/e2e/checkout.test.ts +160 -0
- package/e2e/jest.config.js +13 -0
- package/e2e/tsconfig.json +4 -0
- package/eas-hooks/eas-build-on-success.sh +45 -0
- package/eas-hooks/eas-build-pre-install.sh +39 -0
- package/eas.json +23 -0
- package/fake-dependencies/@lookiero/payments-front/index.tsx +40 -0
- package/fake-dependencies/@lookiero/user-tracking-front/index.js +3 -0
- package/metro.config.js +22 -0
- package/package.json +13 -2
- package/src/Expo.tsx +1 -0
- package/src/ExpoRoot.tsx +14 -31
- package/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.ts +2 -2
- package/src/infrastructure/ui/hooks/useSubmitCheckout.ts +20 -2
- package/src/infrastructure/ui/views/checkout/Checkout.tsx +1 -1
- package/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.tsx +1 -2
- package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.tsx +3 -2
- package/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.tsx +1 -1
- package/src/infrastructure/ui/views/summary/Summary.tsx +1 -1
- package/tsconfig.json +8 -1
- package/webpack.config.js +8 -1
|
@@ -63,7 +63,7 @@ const ItemWithoutCustomerDecission = ({ checkoutId, checkoutItem, bookedProducts
|
|
|
63
63
|
}
|
|
64
64
|
return (React.createElement(React.Fragment, null,
|
|
65
65
|
React.createElement(SizeWithoutStockModal, { visible: sizeWithoutStockModalVisible, onDismiss: handleOnHideSizeWithoutStockModal }),
|
|
66
|
-
React.createElement(ScrollView, { showsVerticalScrollIndicator: false },
|
|
66
|
+
React.createElement(ScrollView, { showsVerticalScrollIndicator: false, testID: checkoutItem.id },
|
|
67
67
|
React.createElement(Body, { style: { row: style.container } },
|
|
68
68
|
React.createElement(ProductVariant, { checkoutId: checkoutId, checkoutItem: checkoutItem, country: country, currentProductVariant: currentProductVariant, segment: segment, style: { content: { paddingBottom: Platform.OS === "web" ? space6 : stickyHeight } } }))),
|
|
69
69
|
React.createElement(ItemActions, { country: country, currentProductVariant: currentProductVariant, productVariants: bookedProductsVariants?.productVariants, onKeep: handleOnKeep, onLayout: handleOnStickyLayout, onReplace: handleOnReplace, onReturn: onReturn, onShowSizeWithoutStockModal: handleOnShowSizeWithoutStockModal })));
|
|
@@ -83,7 +83,7 @@ const Summary = ({ layout: Layout, children }) => {
|
|
|
83
83
|
header: style.header,
|
|
84
84
|
scrollView: style.scrollView,
|
|
85
85
|
} },
|
|
86
|
-
React.createElement(ScrollView, { showsVerticalScrollIndicator: false },
|
|
86
|
+
React.createElement(ScrollView, { showsVerticalScrollIndicator: false, testID: "summary-view" },
|
|
87
87
|
fiveItemsDiscount !== 0 && React.createElement(FiveItemsDiscountBanner, { fiveItemsDiscount: fiveItemsDiscount }),
|
|
88
88
|
React.createElement(AuroraLayout, { fullWidth: !screen.L, style: [screen.L && style.desktopLayoutSpacing, !screen.L && { paddingBottom: pricingHeight }] },
|
|
89
89
|
React.createElement(Box, { size: { L: "2/3" }, style: screen.L && style.desktopListSpacing },
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "8.
|
|
1
|
+
export declare const VERSION = "8.21.0";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "8.
|
|
1
|
+
export const VERSION = "8.21.0";
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { device, waitFor, element, expect } from "detox";
|
|
2
|
+
import { CheckoutStatus } from "../src/domain/checkout/model/checkout";
|
|
3
|
+
import { CheckoutItemStatus } from "../src/domain/checkoutItem/model/checkoutItem";
|
|
4
|
+
import { bookedProductsVariants } from "../src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock";
|
|
5
|
+
import { checkout } from "../src/infrastructure/projection/checkout/checkout.mock";
|
|
6
|
+
import { ProductVariantProjection } from "../src/projection/bookedProductsVariants/bookedProductsVariants";
|
|
7
|
+
|
|
8
|
+
const checkoutProjection = checkout({
|
|
9
|
+
status: CheckoutStatus.STARTED,
|
|
10
|
+
items: [
|
|
11
|
+
{
|
|
12
|
+
status: CheckoutItemStatus.INITIAL,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
status: CheckoutItemStatus.INITIAL,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
status: CheckoutItemStatus.INITIAL,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
status: CheckoutItemStatus.INITIAL,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
status: CheckoutItemStatus.INITIAL,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const randomIndex = (count: number) => Math.floor(Math.random() * count);
|
|
30
|
+
|
|
31
|
+
const keepCheckoutItem = async (id: string) => {
|
|
32
|
+
await expect(element(by.id(id))).toBeVisible();
|
|
33
|
+
|
|
34
|
+
await element(by.id("keep-button")).tap();
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const replaceCheckoutItem = async (id: string) => {
|
|
38
|
+
await expect(element(by.id(id))).toBeVisible();
|
|
39
|
+
|
|
40
|
+
await element(by.id("size-selector")).tap();
|
|
41
|
+
|
|
42
|
+
const index = randomIndex(bookedProductsVariants.productVariants.length);
|
|
43
|
+
const randomBookedProductVariant = bookedProductsVariants.productVariants[index] as ProductVariantProjection;
|
|
44
|
+
|
|
45
|
+
await element(by.id(randomBookedProductVariant.id)).tap();
|
|
46
|
+
|
|
47
|
+
await element(by.id("modal-notification-button")).tap();
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const returnCheckoutItem = async (id: string) => {
|
|
51
|
+
await expect(element(by.id(id))).toBeVisible();
|
|
52
|
+
|
|
53
|
+
await element(by.id("return-button")).tap();
|
|
54
|
+
|
|
55
|
+
await expect(element(by.id("return-questions-form"))).toBeVisible();
|
|
56
|
+
|
|
57
|
+
await element(by.id("9251dc2c-d76a-484d-9299-346929af932f")).tap();
|
|
58
|
+
await element(by.id("68c0bb98-b00a-4b86-af43-528fe903cb69")).tap();
|
|
59
|
+
|
|
60
|
+
await element(by.id("return-questions-form")).scrollTo("bottom");
|
|
61
|
+
|
|
62
|
+
await element(by.id("return-questions-button")).tap();
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const submitCheckout = async () => {
|
|
66
|
+
await waitFor(element(by.id("summary-view")))
|
|
67
|
+
.toBeVisible()
|
|
68
|
+
.withTimeout(2000);
|
|
69
|
+
|
|
70
|
+
await element(by.id("submit-checkout-collpased-button")).tap();
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const confirmCheckout = async () => {
|
|
74
|
+
await waitFor(element(by.id("checkout-view")))
|
|
75
|
+
.toBeVisible()
|
|
76
|
+
.withTimeout(2000);
|
|
77
|
+
|
|
78
|
+
await element(by.id("confirm-checkout-button")).tap();
|
|
79
|
+
|
|
80
|
+
await element(by.id("modal-notification-button")).tap();
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const checkoutFeedback = async () => {
|
|
84
|
+
await waitFor(element(by.id("checkout-questions-form")))
|
|
85
|
+
.toBeVisible()
|
|
86
|
+
.withTimeout(2000);
|
|
87
|
+
|
|
88
|
+
await element(by.id("29441d25-8d9f-471e-a13e-a03f61c88091")).tap();
|
|
89
|
+
await element(by.id("bab3d4f9-0227-4550-a53f-3c125d68429c")).tap();
|
|
90
|
+
await element(by.id("1123a37d-bc00-43a4-9d28-cee1dfaf356c-input")).typeText("Detox E2E test");
|
|
91
|
+
|
|
92
|
+
// Hide keyboard
|
|
93
|
+
await device.pressBack();
|
|
94
|
+
|
|
95
|
+
await element(by.id("checkout-feedback-button")).tap();
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
describe("Checkout", () => {
|
|
99
|
+
beforeAll(async () => {
|
|
100
|
+
await device.launchApp({ newInstance: true });
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
beforeEach(async () => {
|
|
104
|
+
await device.reloadReactNative();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("Keep checkout items", async () => {
|
|
108
|
+
await waitFor(element(by.id(checkoutProjection.items[0]?.id as string)))
|
|
109
|
+
.toBeVisible()
|
|
110
|
+
.withTimeout(10000);
|
|
111
|
+
|
|
112
|
+
await keepCheckoutItem(checkoutProjection.items[0]?.id as string);
|
|
113
|
+
await keepCheckoutItem(checkoutProjection.items[1]?.id as string);
|
|
114
|
+
await keepCheckoutItem(checkoutProjection.items[2]?.id as string);
|
|
115
|
+
await keepCheckoutItem(checkoutProjection.items[3]?.id as string);
|
|
116
|
+
await keepCheckoutItem(checkoutProjection.items[4]?.id as string);
|
|
117
|
+
|
|
118
|
+
await submitCheckout();
|
|
119
|
+
|
|
120
|
+
await confirmCheckout();
|
|
121
|
+
|
|
122
|
+
await checkoutFeedback();
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("Replace checkout items", async () => {
|
|
126
|
+
await waitFor(element(by.id(checkoutProjection.items[0]?.id as string)))
|
|
127
|
+
.toBeVisible()
|
|
128
|
+
.withTimeout(10000);
|
|
129
|
+
|
|
130
|
+
await replaceCheckoutItem(checkoutProjection.items[0]?.id as string);
|
|
131
|
+
await replaceCheckoutItem(checkoutProjection.items[1]?.id as string);
|
|
132
|
+
await replaceCheckoutItem(checkoutProjection.items[2]?.id as string);
|
|
133
|
+
await replaceCheckoutItem(checkoutProjection.items[3]?.id as string);
|
|
134
|
+
await replaceCheckoutItem(checkoutProjection.items[4]?.id as string);
|
|
135
|
+
|
|
136
|
+
await submitCheckout();
|
|
137
|
+
|
|
138
|
+
await confirmCheckout();
|
|
139
|
+
|
|
140
|
+
await checkoutFeedback();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it("Return checkout items", async () => {
|
|
144
|
+
await waitFor(element(by.id(checkoutProjection.items[0]?.id as string)))
|
|
145
|
+
.toBeVisible()
|
|
146
|
+
.withTimeout(10000);
|
|
147
|
+
|
|
148
|
+
await returnCheckoutItem(checkoutProjection.items[0]?.id as string);
|
|
149
|
+
await keepCheckoutItem(checkoutProjection.items[1]?.id as string);
|
|
150
|
+
await keepCheckoutItem(checkoutProjection.items[2]?.id as string);
|
|
151
|
+
await keepCheckoutItem(checkoutProjection.items[3]?.id as string);
|
|
152
|
+
await keepCheckoutItem(checkoutProjection.items[4]?.id as string);
|
|
153
|
+
|
|
154
|
+
await submitCheckout();
|
|
155
|
+
|
|
156
|
+
await confirmCheckout();
|
|
157
|
+
|
|
158
|
+
await checkoutFeedback();
|
|
159
|
+
}, 200000);
|
|
160
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** @type {import('@jest/types').Config.InitialOptions} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
preset: "ts-jest",
|
|
4
|
+
rootDir: "..",
|
|
5
|
+
testMatch: ["<rootDir>/e2e/**/*.test.ts"],
|
|
6
|
+
testTimeout: 120000,
|
|
7
|
+
maxWorkers: 1,
|
|
8
|
+
globalSetup: "detox/runners/jest/globalSetup",
|
|
9
|
+
globalTeardown: "detox/runners/jest/globalTeardown",
|
|
10
|
+
reporters: ["detox/runners/jest/reporter"],
|
|
11
|
+
testEnvironment: "detox/runners/jest/testEnvironment",
|
|
12
|
+
verbose: true,
|
|
13
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
function cleanup()
|
|
4
|
+
{
|
|
5
|
+
echo 'Cleaning up...'
|
|
6
|
+
if [[ "$EAS_BUILD_PLATFORM" == "android" ]]; then
|
|
7
|
+
# Kill emulator
|
|
8
|
+
adb emu kill &
|
|
9
|
+
fi
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if [[ "$EAS_BUILD_PROFILE" != "test" ]]; then
|
|
13
|
+
exit
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
# Fail if anything errors
|
|
17
|
+
set -eox pipefail
|
|
18
|
+
# If this script exits, trap it first and clean up the emulator
|
|
19
|
+
trap cleanup EXIT
|
|
20
|
+
|
|
21
|
+
ANDROID_EMULATOR=pixel_4
|
|
22
|
+
|
|
23
|
+
if [[ "$EAS_BUILD_PLATFORM" == "android" ]]; then
|
|
24
|
+
# Start emulator
|
|
25
|
+
$ANDROID_SDK_ROOT/emulator/emulator @$ANDROID_EMULATOR -no-audio -no-boot-anim -no-window -use-system-libs 2>&1 >/dev/null &
|
|
26
|
+
|
|
27
|
+
# Wait for emulator
|
|
28
|
+
max_retry=10
|
|
29
|
+
counter=0
|
|
30
|
+
until adb shell getprop sys.boot_completed; do
|
|
31
|
+
sleep 10
|
|
32
|
+
[[ counter -eq $max_retry ]] && echo "Failed to start the emulator!" && exit 1
|
|
33
|
+
counter=$((counter + 1))
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
# Execute Android tests
|
|
37
|
+
if [[ "$EAS_BUILD_PROFILE" == "test" ]]; then
|
|
38
|
+
detox test --configuration android.release
|
|
39
|
+
fi
|
|
40
|
+
else
|
|
41
|
+
# Execute iOS tests
|
|
42
|
+
if [[ "$EAS_BUILD_PROFILE" == "test" ]]; then
|
|
43
|
+
detox test --configuration ios.release
|
|
44
|
+
fi
|
|
45
|
+
fi
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -eox pipefail
|
|
4
|
+
|
|
5
|
+
if [[ "$EAS_BUILD_RUNNER" == "eas-build" && "$EAS_BUILD_PROFILE" == "test"* ]]; then
|
|
6
|
+
if [[ "$EAS_BUILD_PLATFORM" == "android" ]]; then
|
|
7
|
+
sudo apt-get --quiet update --yes
|
|
8
|
+
|
|
9
|
+
# Install emulator & video bridge dependencies
|
|
10
|
+
# Source: https://github.com/react-native-community/docker-android/blob/master/Dockerfile
|
|
11
|
+
sudo apt-get --quiet install --yes \
|
|
12
|
+
libc6 \
|
|
13
|
+
libdbus-1-3 \
|
|
14
|
+
libfontconfig1 \
|
|
15
|
+
libgcc1 \
|
|
16
|
+
libpulse0 \
|
|
17
|
+
libtinfo5 \
|
|
18
|
+
libx11-6 \
|
|
19
|
+
libxcb1 \
|
|
20
|
+
libxdamage1 \
|
|
21
|
+
libnss3 \
|
|
22
|
+
libxcomposite1 \
|
|
23
|
+
libxcursor1 \
|
|
24
|
+
libxi6 \
|
|
25
|
+
libxext6 \
|
|
26
|
+
libxfixes3 \
|
|
27
|
+
zlib1g \
|
|
28
|
+
libgl1 \
|
|
29
|
+
pulseaudio \
|
|
30
|
+
socat
|
|
31
|
+
|
|
32
|
+
# Emulator must be API 31 -- API 32 and 33 fail due to https://github.com/wix/Detox/issues/3762
|
|
33
|
+
sdkmanager --install "system-images;android-31;google_apis;x86_64"
|
|
34
|
+
avdmanager --verbose create avd --force --name "pixel_4" --device "pixel_4" --package "system-images;android-31;google_apis;x86_64"
|
|
35
|
+
else
|
|
36
|
+
brew tap wix/brew
|
|
37
|
+
brew install applesimutils
|
|
38
|
+
fi
|
|
39
|
+
fi
|
package/eas.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cli": {
|
|
3
|
+
"version": "^10.2.2"
|
|
4
|
+
},
|
|
5
|
+
"build": {
|
|
6
|
+
"development": {
|
|
7
|
+
"developmentClient": true,
|
|
8
|
+
"distribution": "internal"
|
|
9
|
+
},
|
|
10
|
+
"test": {
|
|
11
|
+
"android": {
|
|
12
|
+
"gradleCommand": ":app:assembleRelease :app:assembleAndroidTest -DtestBuildType=release",
|
|
13
|
+
"withoutCredentials": true
|
|
14
|
+
},
|
|
15
|
+
"ios": {
|
|
16
|
+
"simulator": true
|
|
17
|
+
},
|
|
18
|
+
"env": {
|
|
19
|
+
"EXPO_PUBLIC_APP_VARIANT": "test"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import {
|
|
3
|
+
FC,
|
|
4
|
+
forwardRef,
|
|
5
|
+
ForwardRefExoticComponent,
|
|
6
|
+
PropsWithChildren,
|
|
7
|
+
RefAttributes,
|
|
8
|
+
useImperativeHandle,
|
|
9
|
+
} from "react";
|
|
10
|
+
|
|
11
|
+
const setPaymentsBridge = () => void 0;
|
|
12
|
+
const PaymentsQueryProvider: FC<PropsWithChildren> = ({ children }) => children;
|
|
13
|
+
const PaymentInstrumentSelect: FC = () => null;
|
|
14
|
+
interface StartLegacyBoxCheckoutCallbackArgs {
|
|
15
|
+
readonly status: string;
|
|
16
|
+
readonly final: boolean;
|
|
17
|
+
}
|
|
18
|
+
interface StartLegacyBoxCheckoutFunction {
|
|
19
|
+
(paymentFlowPayload: unknown, callback: (params: StartLegacyBoxCheckoutCallbackArgs) => Promise<void>): void;
|
|
20
|
+
}
|
|
21
|
+
interface PaymentFlowRef {
|
|
22
|
+
readonly startLegacyBoxCheckout: StartLegacyBoxCheckoutFunction;
|
|
23
|
+
}
|
|
24
|
+
const paymentFlowRef: PaymentFlowRef = {
|
|
25
|
+
startLegacyBoxCheckout: async (_paymentFlowPayload, callback) => {
|
|
26
|
+
await callback({ status: "EXECUTED", final: true });
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
const PaymentFlow: ForwardRefExoticComponent<RefAttributes<PaymentFlowRef>> = forwardRef<PaymentFlowRef, unknown>(
|
|
30
|
+
(_props, ref) => {
|
|
31
|
+
useImperativeHandle(ref, () => paymentFlowRef, []);
|
|
32
|
+
return null;
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
PaymentFlow.displayName = "PaymentFlow";
|
|
36
|
+
enum Section {
|
|
37
|
+
BOX_CHECKOUT = "box-checkout",
|
|
38
|
+
}
|
|
39
|
+
export type { PaymentFlowRef };
|
|
40
|
+
export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, paymentFlowRef };
|
package/metro.config.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Learn more https://docs.expo.io/guides/customizing-metro
|
|
2
|
+
const { getDefaultConfig } = require("expo/metro-config");
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
// Find the project and workspace directories
|
|
6
|
+
const projectRoot = __dirname;
|
|
7
|
+
// This can be replaced with `find-yarn-workspace-root`
|
|
8
|
+
const monorepoRoot = path.resolve(projectRoot, '../..');
|
|
9
|
+
|
|
10
|
+
const config = getDefaultConfig(__dirname);
|
|
11
|
+
|
|
12
|
+
// 1. Watch all files within the monorepo
|
|
13
|
+
config.watchFolders = [monorepoRoot];
|
|
14
|
+
// 2. Let Metro know where to resolve packages and in what order
|
|
15
|
+
config.resolver.nodeModulesPaths = [
|
|
16
|
+
path.resolve(projectRoot, 'node_modules'),
|
|
17
|
+
path.resolve(monorepoRoot, 'node_modules'),
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
config.resolver.disableHierarchicalLookup = true;
|
|
21
|
+
|
|
22
|
+
module.exports = config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.21.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"sideEffects": "false",
|
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
"lint": "eslint --fix .",
|
|
13
13
|
"test": "jest",
|
|
14
14
|
"cypress": "METRO_PORT=8084 WEB_PORT=19004 start-server-and-test dev 19004 'cypress run'",
|
|
15
|
-
"cypress:open": "METRO_PORT=8084 WEB_PORT=19004 start-server-and-test dev 19004 'cypress open'"
|
|
15
|
+
"cypress:open": "METRO_PORT=8084 WEB_PORT=19004 start-server-and-test dev 19004 'cypress open'",
|
|
16
|
+
"eas-build-pre-install": "./eas-hooks/eas-build-pre-install.sh",
|
|
17
|
+
"eas-build-post-install": "sty-psp generate-version",
|
|
18
|
+
"eas-build-on-success": "./eas-hooks/eas-build-on-success.sh",
|
|
19
|
+
"eas:all": "eas build -p all -e test"
|
|
16
20
|
},
|
|
17
21
|
"dependencies": {
|
|
18
22
|
"@lookiero/messaging": "^8.1.1",
|
|
@@ -39,6 +43,7 @@
|
|
|
39
43
|
"tiny-invariant": "^1.3.1"
|
|
40
44
|
},
|
|
41
45
|
"devDependencies": {
|
|
46
|
+
"@config-plugins/detox": "^6.0.0",
|
|
42
47
|
"@cypress/webpack-preprocessor": "^6.0.2",
|
|
43
48
|
"@lookiero/eslint-config-sty-psp": "*",
|
|
44
49
|
"@lookiero/event": "^0.3",
|
|
@@ -51,11 +56,17 @@
|
|
|
51
56
|
"@testing-library/react-native": ">=12",
|
|
52
57
|
"@types/jest-when": ">=3",
|
|
53
58
|
"cypress": "^13.14.2",
|
|
59
|
+
"detox": "^20.11.0",
|
|
54
60
|
"apollo-boost": "0.4.4",
|
|
55
61
|
"buffer": "5.6.0",
|
|
56
62
|
"jest-mock-extended": ">=3",
|
|
57
63
|
"jest-when": ">=3",
|
|
58
64
|
"react-intl": "^6.5.1",
|
|
65
|
+
"react-native-gesture-handler": "^2.12.0",
|
|
66
|
+
"react-native-get-random-values": "~1.9.0",
|
|
67
|
+
"react-native-reanimated": "3.14.0",
|
|
68
|
+
"react-native-safe-area-context": "^4.5.0",
|
|
69
|
+
"react-native-svg": "^13.6.0",
|
|
59
70
|
"webpack-bundle-analyzer": "^4.10.2"
|
|
60
71
|
},
|
|
61
72
|
"peerDependencies": {
|
package/src/Expo.tsx
CHANGED
package/src/ExpoRoot.tsx
CHANGED
|
@@ -15,8 +15,8 @@ import { SentryEnvironment } from "@lookiero/sty-psp-logging";
|
|
|
15
15
|
import { Segment } from "@lookiero/sty-psp-segment";
|
|
16
16
|
import { DummyLayout } from "@lookiero/sty-psp-ui";
|
|
17
17
|
import { KameleoonEnvironment } from "./infrastructure/ab-testing/kameleoonEnvironment";
|
|
18
|
-
// import { bootstrap as checkoutMockBootstrap } from "./infrastructure/delivery/bootstrap.mock";
|
|
19
18
|
import { bootstrap as checkoutBootstrap } from "./infrastructure/delivery/bootstrap";
|
|
19
|
+
import { bootstrap as checkoutMockBootstrap } from "./infrastructure/delivery/bootstrap.mock";
|
|
20
20
|
import { root } from "./infrastructure/ui/Root";
|
|
21
21
|
import { Router } from "./infrastructure/ui/routing/router/Router";
|
|
22
22
|
import { Customer } from "./projection/customer/customer";
|
|
@@ -33,7 +33,7 @@ const order: Order = {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
const customer: Customer = {
|
|
36
|
-
customerId: "
|
|
36
|
+
customerId: "f2c07153-940c-4156-bf28-41ebb98391e4",
|
|
37
37
|
country: Country.ES,
|
|
38
38
|
segment: Segment.WOMEN,
|
|
39
39
|
};
|
|
@@ -46,9 +46,13 @@ const sentryConfig: SentryEnvironment = {
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
const apiUrl =
|
|
49
|
-
Platform.OS !== "web"
|
|
49
|
+
Platform.OS !== "web"
|
|
50
|
+
? "https://web2.sp.dev.aws.lookiero.es/checkout/api"
|
|
51
|
+
: __DEV__
|
|
52
|
+
? "/local-to-dev"
|
|
53
|
+
: "/checkout/api";
|
|
50
54
|
const authToken =
|
|
51
|
-
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.
|
|
55
|
+
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU2NTc1MDEsImV4cCI6MTczNjA2NTIxOSwiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjQtMTItMDUiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiZjJjMDcxNTMtOTQwYy00MTU2LWJmMjgtNDFlYmI5ODM5MWU0IiwiaWF0IjoxNzMzMzg2ODE5fQ.inQNjFXDBjUUTiqVy21ZvFGAMSoBHVK_nWIm1uTlXd8";
|
|
52
56
|
const getAuthToken = () => Promise.resolve(authToken);
|
|
53
57
|
|
|
54
58
|
const externalTranslationsUrl =
|
|
@@ -93,30 +97,7 @@ setPaymentsBridge({
|
|
|
93
97
|
},
|
|
94
98
|
isTestEnv: true,
|
|
95
99
|
},
|
|
96
|
-
useFeatureFlags: () => ({
|
|
97
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
98
|
-
ALLOW_GOOGLE_PAY_AT: true,
|
|
99
|
-
ALLOW_GOOGLE_PAY_BE: true,
|
|
100
|
-
ALLOW_GOOGLE_PAY_DE: true,
|
|
101
|
-
ALLOW_GOOGLE_PAY_ES: true,
|
|
102
|
-
ALLOW_GOOGLE_PAY_FR: true,
|
|
103
|
-
ALLOW_GOOGLE_PAY_GB: true,
|
|
104
|
-
ALLOW_GOOGLE_PAY_IT: true,
|
|
105
|
-
ALLOW_GOOGLE_PAY_LU: true,
|
|
106
|
-
ALLOW_GOOGLE_PAY_NL: true,
|
|
107
|
-
ALLOW_GOOGLE_PAY_PT: true,
|
|
108
|
-
ALLOW_GOOGLE_PAY_APP_AT: true,
|
|
109
|
-
ALLOW_GOOGLE_PAY_APP_BE: true,
|
|
110
|
-
ALLOW_GOOGLE_PAY_APP_DE: true,
|
|
111
|
-
ALLOW_GOOGLE_PAY_APP_ES: true,
|
|
112
|
-
ALLOW_GOOGLE_PAY_APP_FR: true,
|
|
113
|
-
ALLOW_GOOGLE_PAY_APP_GB: true,
|
|
114
|
-
ALLOW_GOOGLE_PAY_APP_IT: true,
|
|
115
|
-
ALLOW_GOOGLE_PAY_APP_LU: true,
|
|
116
|
-
ALLOW_GOOGLE_PAY_APP_NL: true,
|
|
117
|
-
ALLOW_GOOGLE_PAY_APP_PT: true,
|
|
118
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
119
|
-
}),
|
|
100
|
+
useFeatureFlags: () => ({}),
|
|
120
101
|
locale: () => Promise.resolve("es-ES"),
|
|
121
102
|
scrollView: ScrollView,
|
|
122
103
|
});
|
|
@@ -126,8 +107,10 @@ const kameleoonConfig: KameleoonEnvironment = {
|
|
|
126
107
|
experiments: {},
|
|
127
108
|
};
|
|
128
109
|
|
|
129
|
-
|
|
130
|
-
|
|
110
|
+
const { Component: Messaging } =
|
|
111
|
+
process.env.EXPO_PUBLIC_APP_VARIANT === "test"
|
|
112
|
+
? checkoutMockBootstrap()
|
|
113
|
+
: checkoutBootstrap({ apiUrl: () => apiUrl, getAuthToken });
|
|
131
114
|
const I18n = i18n({
|
|
132
115
|
fetchTranslation: fetchTranslations({ translations }),
|
|
133
116
|
contextId: "CheckoutI18n",
|
|
@@ -137,7 +120,7 @@ const Root = root({
|
|
|
137
120
|
I18n,
|
|
138
121
|
getAuthToken,
|
|
139
122
|
development: false,
|
|
140
|
-
sentry: () => sentryConfig,
|
|
123
|
+
sentry: () => (process.env.EXPO_PUBLIC_APP_VARIANT === "test" ? ({} as SentryEnvironment) : sentryConfig),
|
|
141
124
|
kameleoon: () => kameleoonConfig,
|
|
142
125
|
})({ customerId: customer.customerId });
|
|
143
126
|
|
|
@@ -14,9 +14,9 @@ const bookedProductsVariants: BookedProductsVariantsProjection = {
|
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
id: "
|
|
17
|
+
id: "01939161-b42a-7ee4-9b82-bc61f0b60734",
|
|
18
18
|
size: {
|
|
19
|
-
id: "
|
|
19
|
+
id: "01938c77-ee0b-7ee0-bd08-9c7131e66a53",
|
|
20
20
|
europe: "M",
|
|
21
21
|
lookiero: "M",
|
|
22
22
|
uk: "M",
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { RefObject, useCallback, useMemo, useState } from "react";
|
|
2
2
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
3
3
|
import { PaymentFlowRef } from "@lookiero/payments-front";
|
|
4
|
-
import { LegacyBoxCheckout } from "@lookiero/payments-front/build/components/PaymentFlow/internals/strategies/LegacyBoxCheckoutStrategy";
|
|
5
|
-
import { ChargeStatus } from "@lookiero/payments-front/build/infrastructure/CheckoutAPI";
|
|
6
4
|
import { Logger } from "@lookiero/sty-psp-logging";
|
|
7
5
|
import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
|
|
8
6
|
import { PaymentFlowPayloadProjection } from "../../../projection/payment/paymentFlowPayload";
|
|
@@ -11,6 +9,26 @@ import { useSubmitCheckout as useSubmitCheckoutCommand } from "../../domain/chec
|
|
|
11
9
|
import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
|
|
12
10
|
import { I18nMessages } from "../i18n/i18n";
|
|
13
11
|
|
|
12
|
+
enum ChargeStatus {
|
|
13
|
+
EXECUTED = "EXECUTED",
|
|
14
|
+
REQUIRES_ACTION = "REQUIRES_ACTION",
|
|
15
|
+
REQUIRED_ACTION_CANCELLED = "REQUIRED_ACTION_CANCELLED",
|
|
16
|
+
REJECTED = "REJECTED",
|
|
17
|
+
CANCELLED = "CANCELLED",
|
|
18
|
+
TO_CONFIRM = "TO_CONFIRM",
|
|
19
|
+
ERROR = "ERROR",
|
|
20
|
+
UNKNOWN = "UNKNOWN",
|
|
21
|
+
}
|
|
22
|
+
interface LegacyBoxCheckout {
|
|
23
|
+
readonly status: ChargeStatus;
|
|
24
|
+
readonly toaster: {
|
|
25
|
+
id: string;
|
|
26
|
+
} | null;
|
|
27
|
+
readonly final: boolean;
|
|
28
|
+
readonly id?: string;
|
|
29
|
+
readonly translation?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
14
32
|
type Status = "idle" | "loading" | "success" | "error";
|
|
15
33
|
|
|
16
34
|
interface SubmitCheckoutFunctionArgs {
|
|
@@ -107,7 +107,7 @@ const Checkout: FC<CheckoutProps> = ({ children, layout: Layout, useRedirect })
|
|
|
107
107
|
scrollView: style.scrollView,
|
|
108
108
|
}}
|
|
109
109
|
>
|
|
110
|
-
<ScrollView showsVerticalScrollIndicator={false}>
|
|
110
|
+
<ScrollView showsVerticalScrollIndicator={false} testID="checkout-view">
|
|
111
111
|
{hasReplacedCheckoutItem && <DeliveryBanner />}
|
|
112
112
|
|
|
113
113
|
<AuroraLayout
|
package/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { FC, useRef } from "react";
|
|
2
|
-
import { PaymentInstrumentSelect,
|
|
2
|
+
import { PaymentInstrumentSelect, Section } from "@lookiero/payments-front";
|
|
3
3
|
import { useLogger } from "@lookiero/sty-psp-logging";
|
|
4
4
|
import { usePaymentInstrumentEvents } from "../../../../hooks/usePaymentInstrumentEvents";
|
|
5
5
|
|
|
@@ -18,7 +18,6 @@ const PaymentInstrument: FC<PaymentInstrumentProps> = ({ useRedirect }) => {
|
|
|
18
18
|
ref={paymentInstrumentSelectRef}
|
|
19
19
|
beforeRedirect={returnUrl ? () => Promise.resolve(returnUrl) : undefined}
|
|
20
20
|
hasError={false}
|
|
21
|
-
hidePaymentMethods={[PaymentMethod.GOOGLE_PAY]}
|
|
22
21
|
section={Section.BOX_CHECKOUT}
|
|
23
22
|
/>
|
|
24
23
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FC, useCallback, useMemo } from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
2
3
|
import { Button } from "@lookiero/aurora";
|
|
3
4
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
4
5
|
import { CheckoutFeedbackProjection } from "../../../../../../projection/checkoutFeedback/checkoutFeedback";
|
|
@@ -54,7 +55,7 @@ const CheckoutQuestionsForm: FC<CheckoutQuestionsFormProps> = ({
|
|
|
54
55
|
}, [checkoutQuestions, feedback]);
|
|
55
56
|
|
|
56
57
|
return (
|
|
57
|
-
|
|
58
|
+
<View testID="checkout-questions-form">
|
|
58
59
|
<CheckoutQuestionItemProvider checkoutQuestionItems={checkoutQuestionItems}>
|
|
59
60
|
<CheckoutQuestions checkoutQuestions={filteredCheckoutQuestions} />
|
|
60
61
|
</CheckoutQuestionItemProvider>
|
|
@@ -62,7 +63,7 @@ const CheckoutQuestionsForm: FC<CheckoutQuestionsFormProps> = ({
|
|
|
62
63
|
<Button busy={submitButtonDisabled} testID="checkout-feedback-button" onPress={handlePress}>
|
|
63
64
|
{buttonText}
|
|
64
65
|
</Button>
|
|
65
|
-
|
|
66
|
+
</View>
|
|
66
67
|
);
|
|
67
68
|
};
|
|
68
69
|
|
|
@@ -104,7 +104,7 @@ const ItemWithoutCustomerDecission: FC<ItemWithoutCustomerDecissionProps> = ({
|
|
|
104
104
|
<>
|
|
105
105
|
<SizeWithoutStockModal visible={sizeWithoutStockModalVisible} onDismiss={handleOnHideSizeWithoutStockModal} />
|
|
106
106
|
|
|
107
|
-
<ScrollView showsVerticalScrollIndicator={false}>
|
|
107
|
+
<ScrollView showsVerticalScrollIndicator={false} testID={checkoutItem.id}>
|
|
108
108
|
<Body style={{ row: style.container }}>
|
|
109
109
|
<ProductVariant
|
|
110
110
|
checkoutId={checkoutId}
|
|
@@ -117,7 +117,7 @@ const Summary: FC<SummaryProps> = ({ layout: Layout, children }) => {
|
|
|
117
117
|
scrollView: style.scrollView,
|
|
118
118
|
}}
|
|
119
119
|
>
|
|
120
|
-
<ScrollView showsVerticalScrollIndicator={false}>
|
|
120
|
+
<ScrollView showsVerticalScrollIndicator={false} testID="summary-view">
|
|
121
121
|
{fiveItemsDiscount !== 0 && <FiveItemsDiscountBanner fiveItemsDiscount={fiveItemsDiscount} />}
|
|
122
122
|
|
|
123
123
|
<AuroraLayout
|
package/tsconfig.json
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@lookiero/sty-psp-typescript/tsconfig.expo.json",
|
|
3
|
-
"include": [
|
|
3
|
+
"include": [
|
|
4
|
+
"@types",
|
|
5
|
+
"index.ts",
|
|
6
|
+
"src/**/*.ts",
|
|
7
|
+
"src/**/*.tsx",
|
|
8
|
+
"fake-dependencies/**/*.ts",
|
|
9
|
+
"fake-dependencies/**/*.tsx"
|
|
10
|
+
],
|
|
4
11
|
"compilerOptions": {
|
|
5
12
|
"outDir": "./dist"
|
|
6
13
|
}
|