@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
package/.detoxrc.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** @type {Detox.DetoxConfig} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
logger: {
|
|
4
|
+
level: process.env.CI ? "debug" : undefined,
|
|
5
|
+
},
|
|
6
|
+
testRunner: {
|
|
7
|
+
$0: "jest",
|
|
8
|
+
args: {
|
|
9
|
+
config: "e2e/jest.config.js",
|
|
10
|
+
_: ["e2e"],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
artifacts: {
|
|
14
|
+
plugins: {
|
|
15
|
+
log: process.env.CI ? "failing" : undefined,
|
|
16
|
+
screenshot: "failing",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
apps: {
|
|
20
|
+
"ios.release": {
|
|
21
|
+
type: "ios.app",
|
|
22
|
+
build: "xcodebuild -project ios/CheckoutLookiero.xcodeproj -scheme test -configuration Release -sdk iphonesimulator -arch x86_64 -derivedDataPath ios/build",
|
|
23
|
+
binaryPath: "ios/build/Build/Products/Release-iphonesimulator/CheckoutLookiero.app",
|
|
24
|
+
},
|
|
25
|
+
"android.release": {
|
|
26
|
+
type: "android.apk",
|
|
27
|
+
build: "cd android && ./gradlew :app:assembleRelease :app:assembleAndroidTest -DtestBuildType=release && cd ..",
|
|
28
|
+
binaryPath: "android/app/build/outputs/apk/release/app-release.apk",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
devices: {
|
|
32
|
+
simulator: {
|
|
33
|
+
type: "ios.simulator",
|
|
34
|
+
device: {
|
|
35
|
+
type: "iPhone 14",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
emulator: {
|
|
39
|
+
type: "android.emulator",
|
|
40
|
+
device: {
|
|
41
|
+
avdName: "pixel_4",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
configurations: {
|
|
46
|
+
"ios.release": {
|
|
47
|
+
device: "simulator",
|
|
48
|
+
app: "ios.release",
|
|
49
|
+
},
|
|
50
|
+
"android.release": {
|
|
51
|
+
device: "emulator",
|
|
52
|
+
app: "android.release",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
package/app.json
CHANGED
|
@@ -16,13 +16,16 @@
|
|
|
16
16
|
},
|
|
17
17
|
"assetBundlePatterns": ["**/*"],
|
|
18
18
|
"ios": {
|
|
19
|
-
"supportsTablet": true
|
|
19
|
+
"supportsTablet": true,
|
|
20
|
+
"bundleIdentifier": "com.lookiero.checkout"
|
|
20
21
|
},
|
|
21
22
|
"android": {
|
|
22
23
|
"adaptiveIcon": {
|
|
23
24
|
"foregroundImage": "./public/assets/adaptive-icon.png",
|
|
24
25
|
"backgroundColor": "#ffffff"
|
|
25
|
-
}
|
|
26
|
+
},
|
|
27
|
+
"permissions": ["android.permission.RECORD_AUDIO"],
|
|
28
|
+
"package": "com.lookiero.checkout"
|
|
26
29
|
},
|
|
27
30
|
"web": {
|
|
28
31
|
"favicon": "./public/assets/favicon.png",
|
|
@@ -31,6 +34,15 @@
|
|
|
31
34
|
"include": ["@tanstack/match-sorter-utils"]
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
|
-
}
|
|
37
|
+
},
|
|
38
|
+
"plugins": ["@config-plugins/detox"],
|
|
39
|
+
"extra": {
|
|
40
|
+
"nativeEntryPoint": "./src/Expo",
|
|
41
|
+
"webEntryPoint": "./src/Expo",
|
|
42
|
+
"eas": {
|
|
43
|
+
"projectId": "c175324b-40e1-4d67-9280-b349638ea23e"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"owner": "lookiero"
|
|
35
47
|
}
|
|
36
48
|
}
|
package/babel.config.js
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
1
3
|
module.exports = function (api) {
|
|
2
4
|
api.cache(true);
|
|
3
5
|
|
|
4
6
|
return {
|
|
5
7
|
presets: ["babel-preset-expo"],
|
|
8
|
+
plugins: [
|
|
9
|
+
[
|
|
10
|
+
"module-resolver",
|
|
11
|
+
{
|
|
12
|
+
alias: {
|
|
13
|
+
"@lookiero/user-tracking-front": path.resolve(
|
|
14
|
+
__dirname,
|
|
15
|
+
"./fake-dependencies/@lookiero/user-tracking-front",
|
|
16
|
+
),
|
|
17
|
+
"@lookiero/payments-front": path.resolve(
|
|
18
|
+
__dirname,
|
|
19
|
+
"./fake-dependencies/@lookiero/payments-front",
|
|
20
|
+
),
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
"react-native-reanimated/plugin",
|
|
25
|
+
],
|
|
6
26
|
};
|
|
7
27
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FC, ForwardRefExoticComponent, PropsWithChildren, RefAttributes } from "react";
|
|
2
|
+
declare const setPaymentsBridge: () => undefined;
|
|
3
|
+
declare const PaymentsQueryProvider: FC<PropsWithChildren>;
|
|
4
|
+
declare const PaymentInstrumentSelect: FC;
|
|
5
|
+
interface StartLegacyBoxCheckoutCallbackArgs {
|
|
6
|
+
readonly status: string;
|
|
7
|
+
readonly final: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface StartLegacyBoxCheckoutFunction {
|
|
10
|
+
(paymentFlowPayload: unknown, callback: (params: StartLegacyBoxCheckoutCallbackArgs) => Promise<void>): void;
|
|
11
|
+
}
|
|
12
|
+
interface PaymentFlowRef {
|
|
13
|
+
readonly startLegacyBoxCheckout: StartLegacyBoxCheckoutFunction;
|
|
14
|
+
}
|
|
15
|
+
declare const paymentFlowRef: PaymentFlowRef;
|
|
16
|
+
declare const PaymentFlow: ForwardRefExoticComponent<RefAttributes<PaymentFlowRef>>;
|
|
17
|
+
declare enum Section {
|
|
18
|
+
BOX_CHECKOUT = "box-checkout"
|
|
19
|
+
}
|
|
20
|
+
export type { PaymentFlowRef };
|
|
21
|
+
export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, paymentFlowRef };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import { forwardRef, useImperativeHandle, } from "react";
|
|
3
|
+
const setPaymentsBridge = () => void 0;
|
|
4
|
+
const PaymentsQueryProvider = ({ children }) => children;
|
|
5
|
+
const PaymentInstrumentSelect = () => null;
|
|
6
|
+
const paymentFlowRef = {
|
|
7
|
+
startLegacyBoxCheckout: async (_paymentFlowPayload, callback) => {
|
|
8
|
+
await callback({ status: "EXECUTED", final: true });
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
const PaymentFlow = forwardRef((_props, ref) => {
|
|
12
|
+
useImperativeHandle(ref, () => paymentFlowRef, []);
|
|
13
|
+
return null;
|
|
14
|
+
});
|
|
15
|
+
PaymentFlow.displayName = "PaymentFlow";
|
|
16
|
+
var Section;
|
|
17
|
+
(function (Section) {
|
|
18
|
+
Section["BOX_CHECKOUT"] = "box-checkout";
|
|
19
|
+
})(Section || (Section = {}));
|
|
20
|
+
export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, paymentFlowRef };
|
package/dist/src/Expo.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import "react-native-get-random-values";
|
package/dist/src/Expo.js
CHANGED
package/dist/src/ExpoRoot.js
CHANGED
|
@@ -12,8 +12,8 @@ import { fetchTranslations, translationExternalEndpoint } from "@lookiero/sty-ps
|
|
|
12
12
|
import { Country, Locale } from "@lookiero/sty-psp-locale";
|
|
13
13
|
import { Segment } from "@lookiero/sty-psp-segment";
|
|
14
14
|
import { DummyLayout } from "@lookiero/sty-psp-ui";
|
|
15
|
-
// import { bootstrap as checkoutMockBootstrap } from "./infrastructure/delivery/bootstrap.mock";
|
|
16
15
|
import { bootstrap as checkoutBootstrap } from "./infrastructure/delivery/bootstrap";
|
|
16
|
+
import { bootstrap as checkoutMockBootstrap } from "./infrastructure/delivery/bootstrap.mock";
|
|
17
17
|
import { root } from "./infrastructure/ui/Root";
|
|
18
18
|
import { Router } from "./infrastructure/ui/routing/router/Router";
|
|
19
19
|
import { VERSION } from "./version";
|
|
@@ -25,7 +25,7 @@ const order = {
|
|
|
25
25
|
coupon: "MYLOOKIERO",
|
|
26
26
|
};
|
|
27
27
|
const customer = {
|
|
28
|
-
customerId: "
|
|
28
|
+
customerId: "f2c07153-940c-4156-bf28-41ebb98391e4",
|
|
29
29
|
country: Country.ES,
|
|
30
30
|
segment: Segment.WOMEN,
|
|
31
31
|
};
|
|
@@ -35,8 +35,12 @@ const sentryConfig = {
|
|
|
35
35
|
project: "4504400729276416",
|
|
36
36
|
environment: `${Platform.OS}-EXPO`,
|
|
37
37
|
};
|
|
38
|
-
const apiUrl = Platform.OS !== "web"
|
|
39
|
-
|
|
38
|
+
const apiUrl = Platform.OS !== "web"
|
|
39
|
+
? "https://web2.sp.dev.aws.lookiero.es/checkout/api"
|
|
40
|
+
: __DEV__
|
|
41
|
+
? "/local-to-dev"
|
|
42
|
+
: "/checkout/api";
|
|
43
|
+
const authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU2NTc1MDEsImV4cCI6MTczNjA2NTIxOSwiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjQtMTItMDUiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiZjJjMDcxNTMtOTQwYy00MTU2LWJmMjgtNDFlYmI5ODM5MWU0IiwiaWF0IjoxNzMzMzg2ODE5fQ.inQNjFXDBjUUTiqVy21ZvFGAMSoBHVK_nWIm1uTlXd8";
|
|
40
44
|
const getAuthToken = () => Promise.resolve(authToken);
|
|
41
45
|
const externalTranslationsUrl = Platform.OS !== "web"
|
|
42
46
|
? "https://backend-for-user.dev.envs.lookiero.tech/api/v2/translations"
|
|
@@ -75,30 +79,7 @@ setPaymentsBridge({
|
|
|
75
79
|
},
|
|
76
80
|
isTestEnv: true,
|
|
77
81
|
},
|
|
78
|
-
useFeatureFlags: () => ({
|
|
79
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
80
|
-
ALLOW_GOOGLE_PAY_AT: true,
|
|
81
|
-
ALLOW_GOOGLE_PAY_BE: true,
|
|
82
|
-
ALLOW_GOOGLE_PAY_DE: true,
|
|
83
|
-
ALLOW_GOOGLE_PAY_ES: true,
|
|
84
|
-
ALLOW_GOOGLE_PAY_FR: true,
|
|
85
|
-
ALLOW_GOOGLE_PAY_GB: true,
|
|
86
|
-
ALLOW_GOOGLE_PAY_IT: true,
|
|
87
|
-
ALLOW_GOOGLE_PAY_LU: true,
|
|
88
|
-
ALLOW_GOOGLE_PAY_NL: true,
|
|
89
|
-
ALLOW_GOOGLE_PAY_PT: true,
|
|
90
|
-
ALLOW_GOOGLE_PAY_APP_AT: true,
|
|
91
|
-
ALLOW_GOOGLE_PAY_APP_BE: true,
|
|
92
|
-
ALLOW_GOOGLE_PAY_APP_DE: true,
|
|
93
|
-
ALLOW_GOOGLE_PAY_APP_ES: true,
|
|
94
|
-
ALLOW_GOOGLE_PAY_APP_FR: true,
|
|
95
|
-
ALLOW_GOOGLE_PAY_APP_GB: true,
|
|
96
|
-
ALLOW_GOOGLE_PAY_APP_IT: true,
|
|
97
|
-
ALLOW_GOOGLE_PAY_APP_LU: true,
|
|
98
|
-
ALLOW_GOOGLE_PAY_APP_NL: true,
|
|
99
|
-
ALLOW_GOOGLE_PAY_APP_PT: true,
|
|
100
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
101
|
-
}),
|
|
82
|
+
useFeatureFlags: () => ({}),
|
|
102
83
|
locale: () => Promise.resolve("es-ES"),
|
|
103
84
|
scrollView: ScrollView,
|
|
104
85
|
});
|
|
@@ -106,8 +87,9 @@ const kameleoonConfig = {
|
|
|
106
87
|
siteCode: "aplm4v3ckn",
|
|
107
88
|
experiments: {},
|
|
108
89
|
};
|
|
109
|
-
|
|
110
|
-
|
|
90
|
+
const { Component: Messaging } = process.env.EXPO_PUBLIC_APP_VARIANT === "test"
|
|
91
|
+
? checkoutMockBootstrap()
|
|
92
|
+
: checkoutBootstrap({ apiUrl: () => apiUrl, getAuthToken });
|
|
111
93
|
const I18n = i18n({
|
|
112
94
|
fetchTranslation: fetchTranslations({ translations }),
|
|
113
95
|
contextId: "CheckoutI18n",
|
|
@@ -117,7 +99,7 @@ const Root = root({
|
|
|
117
99
|
I18n,
|
|
118
100
|
getAuthToken,
|
|
119
101
|
development: false,
|
|
120
|
-
sentry: () => sentryConfig,
|
|
102
|
+
sentry: () => (process.env.EXPO_PUBLIC_APP_VARIANT === "test" ? {} : sentryConfig),
|
|
121
103
|
kameleoon: () => kameleoonConfig,
|
|
122
104
|
})({ customerId: customer.customerId });
|
|
123
105
|
const ExpoRoot = () => {
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { CheckoutItemStatus } from "../../domain/checkoutItem/model/checkoutItem";
|
|
2
|
+
import { getUiSetting, saveUiSetting } from "../domain/uiSetting/model/storageUiSettings";
|
|
3
|
+
import { read, write } from "../persistence/asyncStorageStorage";
|
|
4
|
+
import { bookedProductsVariants } from "../projection/bookedProductsVariants/bookedProductsVariants.mock";
|
|
5
|
+
import { checkout } from "../projection/checkout/checkout.mock";
|
|
6
|
+
import { checkoutBooking as checkoutBookingMock } from "../projection/checkoutBooking/checkoutBooking.mock";
|
|
7
|
+
import { checkoutFeedback as checkoutFeedbackMock } from "../projection/checkoutFeedback/checkoutFeedback.mock";
|
|
8
|
+
import { checkoutQuestions as checkoutQuestionsMock } from "../projection/checkoutQuestion/checkoutQuestions.mock";
|
|
9
|
+
import { feedback as feedbackMock } from "../projection/feedback/feedback.mock";
|
|
10
|
+
import { paymentFlowPayload as paymentFlowPayloadMock } from "../projection/payment/paymentFlowPayload.mock";
|
|
11
|
+
import { pricing as pricingMock } from "../projection/pricing/pricing.mock";
|
|
12
|
+
import { returnQuestions as returnQuestionsMock } from "../projection/returnQuestion/returnQuestions.mock";
|
|
13
|
+
import { storageUiSettingByKeyView } from "../projection/uiSetting/storageUiSettingByKeyView";
|
|
14
|
+
import { baseBootstrap } from "./baseBootstrap";
|
|
15
|
+
import { checkoutBookingDataSource } from "./mock/checkoutBookingDataSource";
|
|
16
|
+
import { checkoutDataSource } from "./mock/checkoutDataSource";
|
|
17
|
+
import { checkoutFeedbackDataSource } from "./mock/checkoutFeedbackDataSource";
|
|
18
|
+
import { getCheckoutBooking, saveCheckoutBooking } from "./mock/dataSourceCheckoutBookings";
|
|
19
|
+
import { getCheckoutFeedback, saveCheckoutFeedback } from "./mock/dataSourceCheckoutFeedbacks";
|
|
20
|
+
import { getCheckoutItem, saveCheckoutItem } from "./mock/dataSourceCheckoutItems";
|
|
21
|
+
import { getCheckout, saveCheckout } from "./mock/dataSourceCheckouts";
|
|
22
|
+
const IS_CHECKOUT_ENABLED = true;
|
|
23
|
+
const IS_SIZE_CHANGE_ENABLED = true;
|
|
24
|
+
const FIVE_ITEMS_DISCOUNT = 25;
|
|
25
|
+
const dataSource = checkoutDataSource({
|
|
26
|
+
data: checkout({
|
|
27
|
+
items: [
|
|
28
|
+
{
|
|
29
|
+
status: CheckoutItemStatus.INITIAL,
|
|
30
|
+
feedbacks: feedbackMock,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
status: CheckoutItemStatus.INITIAL,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
status: CheckoutItemStatus.INITIAL,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
status: CheckoutItemStatus.INITIAL,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
status: CheckoutItemStatus.INITIAL,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
const checkoutBookingData = checkoutBookingDataSource({ data: checkoutBookingMock });
|
|
48
|
+
const checkoutFeedbackData = checkoutFeedbackDataSource({ data: checkoutFeedbackMock });
|
|
49
|
+
const checkoutByIdView = async () => dataSource.getCheckout();
|
|
50
|
+
const firstAvailableCheckoutByCustomerIdView = async () => dataSource.getCheckout();
|
|
51
|
+
const isCheckoutEnabledByCustomerIdView = async () => IS_CHECKOUT_ENABLED;
|
|
52
|
+
const isSizeChangeEnabledByCheckoutIdView = async () => IS_SIZE_CHANGE_ENABLED;
|
|
53
|
+
const fiveItemsDiscountByCustomerIdView = async () => FIVE_ITEMS_DISCOUNT;
|
|
54
|
+
const checkoutItemByIdView = async ({ checkoutItemId }) => dataSource.getCheckoutItem(checkoutItemId);
|
|
55
|
+
const returnQuestionsByCheckoutItemIdView = async () => returnQuestionsMock;
|
|
56
|
+
const checkoutBookingByIdView = async () => checkoutBookingMock;
|
|
57
|
+
const bookedProductsVariantsForCheckoutItemView = async () => bookedProductsVariants;
|
|
58
|
+
const pricingByCheckoutIdView = async () => pricingMock();
|
|
59
|
+
const paymentFlowPayloadByCheckoutIdView = async () => paymentFlowPayloadMock;
|
|
60
|
+
const checkoutQuestionsByCheckoutIdView = async () => checkoutQuestionsMock;
|
|
61
|
+
const bootstrap = () => baseBootstrap({
|
|
62
|
+
checkoutByIdView,
|
|
63
|
+
firstAvailableCheckoutByCustomerIdView,
|
|
64
|
+
isCheckoutEnabledByCustomerIdView,
|
|
65
|
+
isSizeChangeEnabledByCheckoutIdView,
|
|
66
|
+
fiveItemsDiscountByCustomerIdView,
|
|
67
|
+
uiSettingByKeyView: storageUiSettingByKeyView({ read }),
|
|
68
|
+
checkoutItemByIdView,
|
|
69
|
+
returnQuestionsByCheckoutItemIdView,
|
|
70
|
+
checkoutBookingByIdView,
|
|
71
|
+
bookedProductsVariantsForCheckoutItemView,
|
|
72
|
+
pricingByCheckoutIdView,
|
|
73
|
+
paymentFlowPayloadByCheckoutIdView,
|
|
74
|
+
checkoutQuestionsByCheckoutIdView,
|
|
75
|
+
getUiSetting,
|
|
76
|
+
saveUiSetting,
|
|
77
|
+
uiSettingsDependencies: [{ read, write }],
|
|
78
|
+
getCheckout,
|
|
79
|
+
saveCheckout,
|
|
80
|
+
checkoutsDependencies: [{ dataSource }],
|
|
81
|
+
getCheckoutItem,
|
|
82
|
+
saveCheckoutItem,
|
|
83
|
+
checkoutItemsDependencies: [{ dataSource }],
|
|
84
|
+
getCheckoutBooking,
|
|
85
|
+
saveCheckoutBooking,
|
|
86
|
+
checkoutBookingsDependencies: [{ dataSource: checkoutBookingData }],
|
|
87
|
+
getCheckoutFeedback,
|
|
88
|
+
saveCheckoutFeedback,
|
|
89
|
+
checkoutFeedbacksDependencies: [{ dataSource: checkoutFeedbackData }],
|
|
90
|
+
});
|
|
91
|
+
export { bootstrap };
|
package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const bookedProductsVariants = {
|
|
2
|
+
productVariants: [
|
|
3
|
+
{
|
|
4
|
+
id: "383fab95-56eb-4639-bb18-530ab792b4d3",
|
|
5
|
+
size: {
|
|
6
|
+
id: "4f8a26b8-8d2d-4012-b49a-7d2820095598",
|
|
7
|
+
europe: "S",
|
|
8
|
+
lookiero: "S",
|
|
9
|
+
uk: "S",
|
|
10
|
+
it: "S",
|
|
11
|
+
unique: false,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: "01939161-b42a-7ee4-9b82-bc61f0b60734",
|
|
16
|
+
size: {
|
|
17
|
+
id: "01938c77-ee0b-7ee0-bd08-9c7131e66a53",
|
|
18
|
+
europe: "M",
|
|
19
|
+
lookiero: "M",
|
|
20
|
+
uk: "M",
|
|
21
|
+
it: "M",
|
|
22
|
+
unique: false,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
export { bookedProductsVariants };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
|
|
2
|
+
import { CheckoutProjection } from "../../../projection/checkout/checkout";
|
|
3
|
+
import { CheckoutItemFunctionArgs } from "../checkoutItem/checkoutItem.mock";
|
|
4
|
+
import { CheckoutDto } from "./checkout";
|
|
5
|
+
interface CheckoutDtoFunctionArgs {
|
|
6
|
+
readonly status?: CheckoutStatus;
|
|
7
|
+
readonly items: CheckoutItemFunctionArgs[];
|
|
8
|
+
}
|
|
9
|
+
interface CheckoutDtoFunction {
|
|
10
|
+
(args: CheckoutDtoFunctionArgs): CheckoutDto;
|
|
11
|
+
}
|
|
12
|
+
declare const checkoutDto: CheckoutDtoFunction;
|
|
13
|
+
interface CheckoutFunctionArgs extends CheckoutDtoFunctionArgs {
|
|
14
|
+
}
|
|
15
|
+
interface CheckoutFunction {
|
|
16
|
+
(args: CheckoutFunctionArgs): CheckoutProjection;
|
|
17
|
+
}
|
|
18
|
+
declare const checkout: CheckoutFunction;
|
|
19
|
+
export { checkout, checkoutDto };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
|
|
2
|
+
import { checkoutItem } from "../checkoutItem/checkoutItem.mock";
|
|
3
|
+
import { toCheckoutProjection } from "./checkout";
|
|
4
|
+
const itemIds = [
|
|
5
|
+
"a5422445-0e62-4b11-8a3f-1bb5469ee154",
|
|
6
|
+
"cfc76463-621a-485a-b152-c5a9c4dc43d9",
|
|
7
|
+
"a9a4fa26-fcc2-4efa-a6a8-fa29ea07b128",
|
|
8
|
+
"8af02b73-0b0a-46a0-a3a8-d9710815c739",
|
|
9
|
+
"8890e00b-d4ed-4220-ae13-52cd88ae8ed5",
|
|
10
|
+
];
|
|
11
|
+
const checkoutDto = ({ status = CheckoutStatus.STARTED, items }) => ({
|
|
12
|
+
id: "9c450400-0cd7-44a4-b0e3-e0002a9bf8df",
|
|
13
|
+
status,
|
|
14
|
+
customerId: "0df61ca7-7e4d-462b-a422-a57de0d116b4",
|
|
15
|
+
boxId: "9c406e57-100a-4aa6-83c5-016e7c2970e7",
|
|
16
|
+
checkoutBookingId: "07c996bb-a0b4-45f9-ae21-6bb9c784d12b",
|
|
17
|
+
expiresOn: "2022-09-20",
|
|
18
|
+
items: items.map(({ id, status, feedbacks, replacedFor }, index) => checkoutItem({ id: id || itemIds[index], status, feedbacks, replacedFor })),
|
|
19
|
+
});
|
|
20
|
+
const checkout = ({ status, items }) => toCheckoutProjection(checkoutDto({ status, items }));
|
|
21
|
+
export { checkout, checkoutDto };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
|
|
2
|
+
import { CheckoutItemProductVariantProjection, CheckoutItemProjection } from "../../../projection/checkoutItem/checkoutItem";
|
|
3
|
+
import { FeedbackProjection } from "../../../projection/feedback/feedback";
|
|
4
|
+
interface CheckoutItemFunctionArgs {
|
|
5
|
+
readonly id?: string;
|
|
6
|
+
readonly status: CheckoutItemStatus;
|
|
7
|
+
readonly feedbacks?: FeedbackProjection;
|
|
8
|
+
readonly replacedFor?: CheckoutItemProductVariantProjection;
|
|
9
|
+
}
|
|
10
|
+
interface CheckoutItemFunction {
|
|
11
|
+
(args: CheckoutItemFunctionArgs): CheckoutItemProjection;
|
|
12
|
+
}
|
|
13
|
+
declare const checkoutItem: CheckoutItemFunction;
|
|
14
|
+
export type { CheckoutItemFunctionArgs };
|
|
15
|
+
export { checkoutItem };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Currency } from "../../../domain/checkoutItem/model/currency";
|
|
2
|
+
import { MediaPerspective, } from "../../../projection/checkoutItem/checkoutItem";
|
|
3
|
+
const checkoutItem = ({ id = "7b389d69-f157-4234-8531-c1a1eb17dccb", status, feedbacks = {}, replacedFor = null, }) => ({
|
|
4
|
+
id,
|
|
5
|
+
status,
|
|
6
|
+
price: {
|
|
7
|
+
amount: 3999,
|
|
8
|
+
currency: Currency.EUR,
|
|
9
|
+
},
|
|
10
|
+
feedbacks,
|
|
11
|
+
productVariant: {
|
|
12
|
+
id: "7b389d69-f157-4234-8531-c1a1eb17dccb",
|
|
13
|
+
media: [
|
|
14
|
+
{
|
|
15
|
+
id: "d7ec731b-4123-4394-829b-297b952e73e5",
|
|
16
|
+
url: "https://cdn-catalog-back-prod.envs.lookiero.tech/1a/28/1a28f712-a76c-4172-8a11-f15002981dc0.jpg",
|
|
17
|
+
perspective: MediaPerspective.MAIN,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "8055e209-2fe9-44c5-b715-b09ad3ef741c",
|
|
21
|
+
url: "https://cdn-catalog-back-prod.envs.lookiero.tech/15/ac/15aca112-4e71-4646-8db5-7f9723bc0130.jpg",
|
|
22
|
+
perspective: MediaPerspective.DETAIL,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
brand: "CKS",
|
|
26
|
+
name: "Sari Tshirt lines",
|
|
27
|
+
size: {
|
|
28
|
+
id: "b26f7190-d505-4d24-aeb9-ad36e5e6ec4b",
|
|
29
|
+
lookiero: "M",
|
|
30
|
+
uk: "M",
|
|
31
|
+
it: "M",
|
|
32
|
+
europe: "M",
|
|
33
|
+
unique: false,
|
|
34
|
+
},
|
|
35
|
+
color: {
|
|
36
|
+
id: "c228d1b0-d06d-4d5c-a7d5-953fd43af0d8",
|
|
37
|
+
name: "black",
|
|
38
|
+
label: "black_C2",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
replacedFor,
|
|
42
|
+
});
|
|
43
|
+
export { checkoutItem };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { CheckoutQuestionType, } from "../../../projection/checkoutQuestion/checkoutQuestion";
|
|
2
|
+
const checkoutQuestions = [
|
|
3
|
+
{
|
|
4
|
+
id: "efe07b97-f6fb-4b6a-ba92-b68519320b2c",
|
|
5
|
+
name: "checkout_question.selection.question",
|
|
6
|
+
placeholder: "checkout_question.selection.placeholder",
|
|
7
|
+
type: CheckoutQuestionType.HOST_SELECT,
|
|
8
|
+
showCondition: [],
|
|
9
|
+
children: [
|
|
10
|
+
{
|
|
11
|
+
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
12
|
+
name: "checkout_question.icon.bad",
|
|
13
|
+
placeholder: "",
|
|
14
|
+
type: CheckoutQuestionType.ICON,
|
|
15
|
+
showCondition: [],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
19
|
+
name: "checkout_question.icon.regular",
|
|
20
|
+
placeholder: "",
|
|
21
|
+
type: CheckoutQuestionType.ICON,
|
|
22
|
+
showCondition: [],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
26
|
+
name: "checkout_question.icon.good",
|
|
27
|
+
placeholder: "",
|
|
28
|
+
type: CheckoutQuestionType.ICON,
|
|
29
|
+
showCondition: [],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "6a6d3878-5561-412c-96f3-7ed79ee587bb",
|
|
35
|
+
name: "checkout_question.experience.question",
|
|
36
|
+
placeholder: "checkout_question.experience.placeholder",
|
|
37
|
+
type: CheckoutQuestionType.HOST_SELECT,
|
|
38
|
+
showCondition: [],
|
|
39
|
+
children: [
|
|
40
|
+
{
|
|
41
|
+
id: "a3d937b6-7499-4a3c-86bf-5c0af9ab2e23",
|
|
42
|
+
name: "checkout_question.icon.bad",
|
|
43
|
+
placeholder: "",
|
|
44
|
+
type: CheckoutQuestionType.ICON,
|
|
45
|
+
showCondition: [],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "7970edd3-fb5c-42d3-afe3-ce31bcbb856c",
|
|
49
|
+
name: "checkout_question.icon.regular",
|
|
50
|
+
placeholder: "",
|
|
51
|
+
type: CheckoutQuestionType.ICON,
|
|
52
|
+
showCondition: [],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "bab3d4f9-0227-4550-a53f-3c125d68429c",
|
|
56
|
+
name: "checkout_question.icon.good",
|
|
57
|
+
placeholder: "",
|
|
58
|
+
type: CheckoutQuestionType.ICON,
|
|
59
|
+
showCondition: [],
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "a1acdb2d-62c8-467f-b7cc-dc24d967290c",
|
|
65
|
+
name: "checkout_question.personalshopper.question",
|
|
66
|
+
placeholder: "checkout_question.personalshopper.placeholder",
|
|
67
|
+
type: CheckoutQuestionType.HOST_SELECT,
|
|
68
|
+
showCondition: ["68c0bb98-b00a-4b86-af43-528fe903cb69"],
|
|
69
|
+
children: [
|
|
70
|
+
{
|
|
71
|
+
id: "cce7851c-92c7-461b-8dcb-903c5de59ed1",
|
|
72
|
+
name: "checkout_question.personalshopper.yes",
|
|
73
|
+
placeholder: "",
|
|
74
|
+
type: CheckoutQuestionType.BUTTON,
|
|
75
|
+
showCondition: [],
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "4bf8f27d-669b-4d36-8d39-b5599c671816",
|
|
79
|
+
name: "checkout_question.personalshopper.no",
|
|
80
|
+
placeholder: "",
|
|
81
|
+
type: CheckoutQuestionType.BUTTON,
|
|
82
|
+
showCondition: [],
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: "ce3e8d57-5eea-4dd3-bef4-2e811a143612",
|
|
88
|
+
name: "checkout_question.comment.question",
|
|
89
|
+
placeholder: "",
|
|
90
|
+
type: CheckoutQuestionType.HOST_TEXTAREA,
|
|
91
|
+
showCondition: [],
|
|
92
|
+
children: [
|
|
93
|
+
{
|
|
94
|
+
id: "1123a37d-bc00-43a4-9d28-cee1dfaf356c",
|
|
95
|
+
name: "checkout_question.comment.question",
|
|
96
|
+
placeholder: "checkout_question.comment.placeholder",
|
|
97
|
+
type: CheckoutQuestionType.TEXTAREA,
|
|
98
|
+
showCondition: [],
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
export { checkoutQuestions };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const feedback = {
|
|
2
|
+
["0ad1dba8-b02c-4121-a1e3-981f1c30800d"]: "9251dc2c-d76a-484d-9299-346929af932f",
|
|
3
|
+
["542c4d24-e1da-484f-8c3a-7d89ee135adc"]: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
4
|
+
["1123a37d-bc00-43a4-9d28-cee1dfaf356c"]: "Free text comment",
|
|
5
|
+
};
|
|
6
|
+
export { feedback };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PaymentFlowPayloadProjection } from "../../../projection/payment/paymentFlowPayload";
|
|
2
|
+
declare const paymentFlowPayloadForKeptItems: PaymentFlowPayloadProjection;
|
|
3
|
+
declare const paymentFlowPayloadForReturnedItems: PaymentFlowPayloadProjection;
|
|
4
|
+
declare const paymentFlowPayloadForReplacedItems: PaymentFlowPayloadProjection;
|
|
5
|
+
declare const paymentFlowPayload: PaymentFlowPayloadProjection;
|
|
6
|
+
export { paymentFlowPayload, paymentFlowPayloadForKeptItems, paymentFlowPayloadForReturnedItems, paymentFlowPayloadForReplacedItems, };
|