@lookiero/checkout 12.4.0 → 12.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/public/public/assets/adaptive-icon.png +0 -0
- package/dist/public/public/assets/favicon.png +0 -0
- package/dist/public/public/assets/icon.png +0 -0
- package/dist/public/public/assets/splash.png +0 -0
- package/dist/public/public/images/not-found.png +0 -0
- package/dist/src/ExpoRoot.js +1 -1
- package/dist/src/domain/checkoutItem/model/currency.d.ts +6 -0
- package/dist/src/domain/checkoutItem/model/currency.js +7 -0
- package/dist/src/domain/uiSetting/command/updateUiSetting.d.ts +15 -0
- package/dist/src/domain/uiSetting/command/updateUiSetting.js +10 -0
- package/dist/src/domain/uiSetting/model/uiSetting.d.ts +9 -0
- package/dist/src/domain/uiSetting/model/uiSetting.js +11 -0
- package/dist/src/domain/uiSetting/model/uiSettingUpdated.d.ts +15 -0
- package/dist/src/domain/uiSetting/model/uiSettingUpdated.js +8 -0
- package/dist/src/domain/uiSetting/model/uiSettings.d.ts +7 -0
- package/dist/src/domain/uiSetting/model/uiSettings.js +1 -0
- package/dist/src/infrastructure/domain/uiSetting/model/storageUiSettings.d.ts +17 -0
- package/dist/src/infrastructure/domain/uiSetting/model/storageUiSettings.js +20 -0
- package/dist/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.d.ts +18 -0
- package/dist/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.js +22 -0
- package/dist/src/infrastructure/integration/useRedirect.d.ts +7 -0
- package/dist/src/infrastructure/integration/useRedirect.js +1 -0
- package/dist/src/infrastructure/persistence/asyncStorageStorage.d.ts +5 -0
- package/dist/src/infrastructure/persistence/asyncStorageStorage.js +7 -0
- package/dist/src/infrastructure/persistence/uiSettingData.d.ts +6 -0
- package/dist/src/infrastructure/persistence/uiSettingData.js +1 -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/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.d.ts +12 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.js +10 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.d.ts +10 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.js +9 -0
- package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +47 -58
- package/dist/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.d.ts +10 -0
- package/dist/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.js +11 -0
- package/dist/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.d.ts +13 -0
- package/dist/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.js +15 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.d.ts +4 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.js +17 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.style.d.ts +11 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.style.js +16 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.d.ts +1 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.js +3 -5
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +2 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.js +2 -4
- package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.d.ts +27 -0
- package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +97 -0
- package/dist/src/infrastructure/ui/routing/useBasePath.d.ts +8 -0
- package/dist/src/infrastructure/ui/routing/useBasePath.js +9 -0
- package/dist/src/infrastructure/ui/settings/UISettings.d.ts +3 -0
- package/dist/src/infrastructure/ui/settings/UISettings.js +4 -0
- package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.d.ts +12 -0
- package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +90 -0
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +1 -0
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +3 -1
- package/dist/src/projection/checkoutQuestion/checkoutQuestion.d.ts +18 -0
- package/dist/src/projection/checkoutQuestion/checkoutQuestion.js +10 -0
- package/dist/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.d.ts +25 -0
- package/dist/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.js +8 -0
- package/dist/src/projection/returnQuestion/returnQuestion.constants.d.ts +1 -0
- package/dist/src/projection/returnQuestion/returnQuestion.constants.js +1 -0
- package/dist/src/projection/returnQuestion/returnQuestion.d.ts +2 -2
- package/dist/src/projection/returnQuestion/returnQuestion.typeguard.d.ts +2 -4
- package/dist/src/projection/returnQuestion/returnQuestion.typeguard.js +2 -2
- package/dist/src/projection/uiSetting/viewUiSettingByKey.d.ts +29 -0
- package/dist/src/projection/uiSetting/viewUiSettingByKey.js +8 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
- package/src/ExpoRoot.tsx +1 -1
- package/src/infrastructure/projection/returnQuestion/returnQuestions.mock.ts +47 -58
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +1 -2
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.style.ts +19 -0
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.tsx +36 -0
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.test.tsx +46 -0
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.tsx +7 -12
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.tsx +6 -5
- package/src/infrastructure/ui/components/organisms/returnQuestions/util/__snapshots__/returnQuestionFeedback.test.ts.snap +22 -2
- package/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.ts +2 -7
- package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +1 -0
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +3 -1
- package/src/projection/returnQuestion/returnQuestion.constants.ts +1 -0
- package/src/projection/returnQuestion/returnQuestion.ts +6 -2
- package/src/projection/returnQuestion/returnQuestion.typeguard.ts +3 -11
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/src/ExpoRoot.js
CHANGED
|
@@ -28,7 +28,7 @@ const order = {
|
|
|
28
28
|
coupon: "MYLOOKIERO",
|
|
29
29
|
};
|
|
30
30
|
const customer = {
|
|
31
|
-
customerId: "
|
|
31
|
+
customerId: "c7373f39-cae1-4b6d-9711-19eaf007d6a8",
|
|
32
32
|
country: Country.NL,
|
|
33
33
|
segment: Segment.WOMEN,
|
|
34
34
|
email: "email@example.com",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from "@lookiero/messaging";
|
|
2
|
+
declare const UPDATE_UI_SETTING = "update_ui_setting";
|
|
3
|
+
interface UpdateUiSettingPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
readonly key: string;
|
|
6
|
+
readonly value: unknown;
|
|
7
|
+
}
|
|
8
|
+
interface UpdateUiSetting extends Command<typeof UPDATE_UI_SETTING>, UpdateUiSettingPayload {
|
|
9
|
+
}
|
|
10
|
+
interface UpdateUiSettingFunction {
|
|
11
|
+
(payload: UpdateUiSettingPayload): UpdateUiSetting;
|
|
12
|
+
}
|
|
13
|
+
declare const updateUiSetting: UpdateUiSettingFunction;
|
|
14
|
+
export type { UpdateUiSetting };
|
|
15
|
+
export { UPDATE_UI_SETTING, updateUiSetting };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { command } from "@lookiero/messaging";
|
|
2
|
+
const UPDATE_UI_SETTING = "update_ui_setting";
|
|
3
|
+
const updateUiSetting = ({ aggregateId, ...payload }) => ({
|
|
4
|
+
...command({
|
|
5
|
+
aggregateId,
|
|
6
|
+
name: UPDATE_UI_SETTING,
|
|
7
|
+
}),
|
|
8
|
+
...payload,
|
|
9
|
+
});
|
|
10
|
+
export { UPDATE_UI_SETTING, updateUiSetting };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
|
|
2
|
+
import { UpdateUiSetting } from "../command/updateUiSetting";
|
|
3
|
+
interface UiSetting extends AggregateRoot {
|
|
4
|
+
readonly key: string;
|
|
5
|
+
readonly value: unknown;
|
|
6
|
+
}
|
|
7
|
+
declare const updateUiSettingHandler: CommandHandlerFunction<UpdateUiSetting, UiSetting>;
|
|
8
|
+
export type { UiSetting };
|
|
9
|
+
export { updateUiSettingHandler };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { uiSettingUpdated } from "./uiSettingUpdated";
|
|
2
|
+
const updateUiSettingHandler = () => async ({ aggregateRoot, command }) => {
|
|
3
|
+
const { aggregateId, key, value } = command;
|
|
4
|
+
return {
|
|
5
|
+
...aggregateRoot,
|
|
6
|
+
key,
|
|
7
|
+
value,
|
|
8
|
+
domainEvents: [uiSettingUpdated({ aggregateId, key })],
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export { updateUiSettingHandler };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DomainEvent, MessageName } from "@lookiero/messaging";
|
|
2
|
+
declare const UI_SETTING_UPDATED = "ui_setting_updated";
|
|
3
|
+
interface UiSettingUpdatedPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
readonly key: string;
|
|
6
|
+
}
|
|
7
|
+
interface UiSettingUpdated extends DomainEvent<typeof UI_SETTING_UPDATED>, UiSettingUpdatedPayload {
|
|
8
|
+
}
|
|
9
|
+
interface UiSettingUpdatedFunction {
|
|
10
|
+
(payload: UiSettingUpdatedPayload): UiSettingUpdated;
|
|
11
|
+
}
|
|
12
|
+
declare const uiSettingUpdated: UiSettingUpdatedFunction;
|
|
13
|
+
declare const isUiSettingUpdated: (event: DomainEvent<MessageName>) => event is UiSettingUpdated;
|
|
14
|
+
export type { UiSettingUpdated };
|
|
15
|
+
export { UI_SETTING_UPDATED, uiSettingUpdated, isUiSettingUpdated };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { domainEvent } from "@lookiero/messaging";
|
|
2
|
+
const UI_SETTING_UPDATED = "ui_setting_updated";
|
|
3
|
+
const uiSettingUpdated = ({ aggregateId, key }) => ({
|
|
4
|
+
...domainEvent({ aggregateId, name: UI_SETTING_UPDATED }),
|
|
5
|
+
key,
|
|
6
|
+
});
|
|
7
|
+
const isUiSettingUpdated = (event) => event.name === UI_SETTING_UPDATED;
|
|
8
|
+
export { UI_SETTING_UPDATED, uiSettingUpdated, isUiSettingUpdated };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RepositoryGetFunction, RepositoryGetFunctionArgs, RepositorySaveFunction, RepositorySaveFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
import { UiSetting } from "./uiSetting";
|
|
3
|
+
interface UiSettingGetFunction<UiSettingGetFunctionArgs extends RepositoryGetFunctionArgs> extends RepositoryGetFunction<UiSetting, UiSettingGetFunctionArgs> {
|
|
4
|
+
}
|
|
5
|
+
interface UiSettingSaveFunction<UiSettingSaveFunctionArgs extends RepositorySaveFunctionArgs> extends RepositorySaveFunction<UiSetting, UiSettingSaveFunctionArgs> {
|
|
6
|
+
}
|
|
7
|
+
export type { UiSettingGetFunction, UiSettingSaveFunction };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RepositoryGetFunctionArgs, RepositorySaveFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
import { UiSettingGetFunction, UiSettingSaveFunction } from "../../../../domain/uiSetting/model/uiSettings";
|
|
3
|
+
import { ReadFunction, WriteFunction } from "../../../persistence/storage";
|
|
4
|
+
import { UiSettingDto } from "../../../persistence/uiSettingData";
|
|
5
|
+
interface StorageUiSettingsGetFunctionArgs extends RepositoryGetFunctionArgs {
|
|
6
|
+
readonly read: ReadFunction<UiSettingDto>;
|
|
7
|
+
}
|
|
8
|
+
interface StorageUiSettingsGetFunction extends UiSettingGetFunction<StorageUiSettingsGetFunctionArgs> {
|
|
9
|
+
}
|
|
10
|
+
declare const getUiSetting: StorageUiSettingsGetFunction;
|
|
11
|
+
interface StorageUiSettingsSaveFunctionArgs extends RepositorySaveFunctionArgs {
|
|
12
|
+
readonly write: WriteFunction<UiSettingDto>;
|
|
13
|
+
}
|
|
14
|
+
interface StorageUiSettingsSaveFunction extends UiSettingSaveFunction<StorageUiSettingsSaveFunctionArgs> {
|
|
15
|
+
}
|
|
16
|
+
declare const saveUiSetting: StorageUiSettingsSaveFunction;
|
|
17
|
+
export { getUiSetting, saveUiSetting };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const toDomain = (uiSettingDto) => ({
|
|
2
|
+
aggregateId: uiSettingDto.id,
|
|
3
|
+
key: uiSettingDto.key,
|
|
4
|
+
value: uiSettingDto.value,
|
|
5
|
+
domainEvents: [],
|
|
6
|
+
});
|
|
7
|
+
const fromDomain = (uiSetting) => ({
|
|
8
|
+
id: uiSetting.aggregateId,
|
|
9
|
+
key: uiSetting.key,
|
|
10
|
+
value: uiSetting.value,
|
|
11
|
+
});
|
|
12
|
+
const getUiSetting = ({ read }) => async (uiSettingKey) => {
|
|
13
|
+
const uiSettingDto = await read(uiSettingKey);
|
|
14
|
+
if (!uiSettingDto) {
|
|
15
|
+
throw new Error(`UiSetting not found: ${uiSettingKey}`);
|
|
16
|
+
}
|
|
17
|
+
return toDomain(uiSettingDto);
|
|
18
|
+
};
|
|
19
|
+
const saveUiSetting = ({ write }) => async (aggregateRoot) => await write(aggregateRoot.key, fromDomain(aggregateRoot));
|
|
20
|
+
export { getUiSetting, saveUiSetting };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
import { Logger } from "@lookiero/sty-psp-logging";
|
|
3
|
+
interface UpdateFunctionArgs {
|
|
4
|
+
readonly key: string;
|
|
5
|
+
readonly value: unknown;
|
|
6
|
+
}
|
|
7
|
+
interface UpdateFunction {
|
|
8
|
+
(args: UpdateFunctionArgs): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
type UseUpdateUiSetting = [update: UpdateFunction, status: CommandStatus];
|
|
11
|
+
interface UseUpdateUiSettingArgs {
|
|
12
|
+
readonly logger: Logger;
|
|
13
|
+
}
|
|
14
|
+
interface UseUpdateUiSettingFunction {
|
|
15
|
+
(args: UseUpdateUiSettingArgs): UseUpdateUiSetting;
|
|
16
|
+
}
|
|
17
|
+
declare const useUpdateUiSetting: UseUpdateUiSettingFunction;
|
|
18
|
+
export { useUpdateUiSetting };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { v4 as uuid } from "uuid";
|
|
3
|
+
import { useCommand } from "@lookiero/messaging-react";
|
|
4
|
+
import { updateUiSetting } from "../../../../domain/uiSetting/command/updateUiSetting";
|
|
5
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
6
|
+
const useUpdateUiSetting = ({ logger }) => {
|
|
7
|
+
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
|
+
const update = useCallback(async ({ key, value }) => {
|
|
9
|
+
try {
|
|
10
|
+
await commandBus(updateUiSetting({
|
|
11
|
+
aggregateId: uuid(),
|
|
12
|
+
key,
|
|
13
|
+
value,
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
logger.captureException(error);
|
|
18
|
+
}
|
|
19
|
+
}, [commandBus, logger]);
|
|
20
|
+
return [update, status];
|
|
21
|
+
};
|
|
22
|
+
export { useUpdateUiSetting };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
2
|
+
const read = async (key) => {
|
|
3
|
+
const value = await AsyncStorage.getItem(key);
|
|
4
|
+
return value ? JSON.parse(value) : null;
|
|
5
|
+
};
|
|
6
|
+
const write = async (key, value) => AsyncStorage.setItem(key, JSON.stringify(value));
|
|
7
|
+
export { read, write };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,12 @@
|
|
|
1
|
+
import { HttpPostFunction } from "@lookiero/sty-psp-http";
|
|
2
|
+
import { CheckoutQuestionsByCheckoutIdView } from "../../../projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId";
|
|
3
|
+
interface HttpCheckoutQuestionsByCheckoutIdView extends CheckoutQuestionsByCheckoutIdView {
|
|
4
|
+
}
|
|
5
|
+
interface HttpCheckoutQuestionsByCheckoutIdViewFunctionArgs {
|
|
6
|
+
readonly httpPost: HttpPostFunction;
|
|
7
|
+
}
|
|
8
|
+
interface HttpCheckoutQuestionsByCheckoutIdViewFunction {
|
|
9
|
+
(args: HttpCheckoutQuestionsByCheckoutIdViewFunctionArgs): HttpCheckoutQuestionsByCheckoutIdView;
|
|
10
|
+
}
|
|
11
|
+
declare const httpCheckoutQuestionsByCheckoutIdView: HttpCheckoutQuestionsByCheckoutIdViewFunction;
|
|
12
|
+
export { httpCheckoutQuestionsByCheckoutIdView };
|
package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const httpCheckoutQuestionsByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => await httpPost({
|
|
2
|
+
endpoint: "/list-checkout-questions-by-checkout-id",
|
|
3
|
+
body: { checkoutId },
|
|
4
|
+
signal,
|
|
5
|
+
result: {
|
|
6
|
+
error: null,
|
|
7
|
+
success: (response) => response.result,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export { httpCheckoutQuestionsByCheckoutIdView };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
|
+
import { CheckoutQuestionProjection } from "../../../../projection/checkoutQuestion/checkoutQuestion";
|
|
3
|
+
interface UseListChckoutQuestionsByCheckoutIdFunctionArgs {
|
|
4
|
+
readonly checkoutId: string;
|
|
5
|
+
}
|
|
6
|
+
interface UseListChckoutQuestionsByCheckoutIdFunction {
|
|
7
|
+
(args: UseListChckoutQuestionsByCheckoutIdFunctionArgs): UseQueryFunctionResult<CheckoutQuestionProjection[]>;
|
|
8
|
+
}
|
|
9
|
+
declare const useListCheckoutQuestionsByCheckoutId: UseListChckoutQuestionsByCheckoutIdFunction;
|
|
10
|
+
export { useListCheckoutQuestionsByCheckoutId };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
+
import { listCheckoutQuestionsByCheckoutId } from "../../../../projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId";
|
|
3
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
4
|
+
const useListCheckoutQuestionsByCheckoutId = ({ checkoutId }) => useQuery({
|
|
5
|
+
query: listCheckoutQuestionsByCheckoutId({ checkoutId }),
|
|
6
|
+
contextId: MESSAGING_CONTEXT_ID,
|
|
7
|
+
options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
8
|
+
});
|
|
9
|
+
export { useListCheckoutQuestionsByCheckoutId };
|
|
@@ -6,76 +6,65 @@ const returnQuestions = [
|
|
|
6
6
|
type: ReturnQuestionType.HOST_DEFAULT,
|
|
7
7
|
children: [
|
|
8
8
|
{
|
|
9
|
-
id: "
|
|
10
|
-
|
|
11
|
-
type: ReturnQuestionType.HOST_SELECT,
|
|
12
|
-
metadata: {
|
|
13
|
-
placeholder: "size_placeholder",
|
|
14
|
-
},
|
|
9
|
+
id: "0ad1dba8-b02c-4121-a1e3-981f1c30800d",
|
|
10
|
+
type: ReturnQuestionType.HOST_RADIO_GROUP,
|
|
15
11
|
children: [
|
|
16
12
|
{
|
|
17
|
-
id: "
|
|
18
|
-
translationKey: "
|
|
19
|
-
type: ReturnQuestionType.
|
|
13
|
+
id: "9251dc2c-d76a-484d-9299-346929af932f",
|
|
14
|
+
translationKey: "size_large",
|
|
15
|
+
type: ReturnQuestionType.OPTION,
|
|
20
16
|
children: [
|
|
21
17
|
{
|
|
22
|
-
id: "
|
|
23
|
-
|
|
24
|
-
type: ReturnQuestionType.OPTION,
|
|
18
|
+
id: "542c4d24-e1da-484f-8c3a-7d89ee135adc",
|
|
19
|
+
type: ReturnQuestionType.HOST_STACK,
|
|
25
20
|
children: [
|
|
26
21
|
{
|
|
27
|
-
id: "
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
42
|
-
translationKey: "size_fit_cut_does_not_fit",
|
|
43
|
-
type: ReturnQuestionType.OPTION,
|
|
44
|
-
},
|
|
45
|
-
],
|
|
22
|
+
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
23
|
+
translationKey: "size_overall",
|
|
24
|
+
type: ReturnQuestionType.OPTION,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
28
|
+
translationKey: "size_trousers_too_long",
|
|
29
|
+
type: ReturnQuestionType.OPTION,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
33
|
+
translationKey: "size_fit_cut_does_not_fit",
|
|
34
|
+
type: ReturnQuestionType.OPTION,
|
|
46
35
|
},
|
|
47
36
|
],
|
|
48
37
|
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "a081c3e9-1904-4a60-8899-b72c1a3a0291",
|
|
42
|
+
translationKey: "size_correct",
|
|
43
|
+
type: ReturnQuestionType.OPTION,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "624cce3d-bd86-463a-b16b-c862ad73d5f3",
|
|
47
|
+
translationKey: "size_small",
|
|
48
|
+
type: ReturnQuestionType.OPTION,
|
|
49
|
+
children: [
|
|
49
50
|
{
|
|
50
|
-
id: "
|
|
51
|
-
|
|
52
|
-
type: ReturnQuestionType.OPTION,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: "624cce3d-bd86-463a-b16b-c862ad73d5f3",
|
|
56
|
-
translationKey: "size_small",
|
|
57
|
-
type: ReturnQuestionType.OPTION,
|
|
51
|
+
id: "58e5ae9a-bc0d-4d27-b267-854a51c2a79a",
|
|
52
|
+
type: ReturnQuestionType.HOST_STACK,
|
|
58
53
|
children: [
|
|
59
54
|
{
|
|
60
|
-
id: "
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{
|
|
74
|
-
id: "e77232ae-eeec-4722-b2d3-f5c0d34fd0ca",
|
|
75
|
-
translationKey: "size_fit_cut_does_not_fit",
|
|
76
|
-
type: ReturnQuestionType.OPTION,
|
|
77
|
-
},
|
|
78
|
-
],
|
|
55
|
+
id: "6a3d11fc-570c-4085-a850-1967228cdd4c",
|
|
56
|
+
translationKey: "size_overall",
|
|
57
|
+
type: ReturnQuestionType.OPTION,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "c27e1936-deea-4dbe-a8f1-fe4fb8564deb",
|
|
61
|
+
translationKey: "size_trousers_too_short",
|
|
62
|
+
type: ReturnQuestionType.OPTION,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "e77232ae-eeec-4722-b2d3-f5c0d34fd0ca",
|
|
66
|
+
translationKey: "size_fit_cut_does_not_fit",
|
|
67
|
+
type: ReturnQuestionType.OPTION,
|
|
79
68
|
},
|
|
80
69
|
],
|
|
81
70
|
},
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
|
+
import { UiSettingProjection } from "../../../../projection/uiSetting/viewUiSettingByKey";
|
|
3
|
+
interface UseViewUiSettingByKeyFunctionArgs {
|
|
4
|
+
readonly key: string;
|
|
5
|
+
}
|
|
6
|
+
interface UseViewUiSettingByKeyFunction {
|
|
7
|
+
(args: UseViewUiSettingByKeyFunctionArgs): UseQueryFunctionResult<UiSettingProjection>;
|
|
8
|
+
}
|
|
9
|
+
declare const useViewUiSettingByKey: UseViewUiSettingByKeyFunction;
|
|
10
|
+
export { useViewUiSettingByKey };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
+
import { isUiSettingUpdated } from "../../../../domain/uiSetting/model/uiSettingUpdated";
|
|
3
|
+
import { viewUiSettingByKey } from "../../../../projection/uiSetting/viewUiSettingByKey";
|
|
4
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
5
|
+
const useViewUiSettingByKey = ({ key }) => useQuery({
|
|
6
|
+
query: viewUiSettingByKey({ key }),
|
|
7
|
+
contextId: MESSAGING_CONTEXT_ID,
|
|
8
|
+
invalidation: isUiSettingUpdated,
|
|
9
|
+
options: { refetchOnMount: "always", staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
10
|
+
});
|
|
11
|
+
export { useViewUiSettingByKey };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UiSettingByKeyView } from "../../../projection/uiSetting/viewUiSettingByKey";
|
|
2
|
+
import { ReadFunction } from "../../persistence/storage";
|
|
3
|
+
import { UiSettingDto } from "../../persistence/uiSettingData";
|
|
4
|
+
interface StorageUiSettingByKeyView extends UiSettingByKeyView {
|
|
5
|
+
}
|
|
6
|
+
interface StorageUiSettingByKeyViewFunctionArgs {
|
|
7
|
+
readonly read: ReadFunction<UiSettingDto>;
|
|
8
|
+
}
|
|
9
|
+
interface StorageUiSettingByKeyViewFunction {
|
|
10
|
+
(args: StorageUiSettingByKeyViewFunctionArgs): StorageUiSettingByKeyView;
|
|
11
|
+
}
|
|
12
|
+
declare const storageUiSettingByKeyView: StorageUiSettingByKeyViewFunction;
|
|
13
|
+
export { storageUiSettingByKeyView };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const toUiSettingProjection = (uiSettingDto) => ({
|
|
2
|
+
id: uiSettingDto.id,
|
|
3
|
+
key: uiSettingDto.key,
|
|
4
|
+
value: uiSettingDto.value,
|
|
5
|
+
});
|
|
6
|
+
const storageUiSettingByKeyView = ({ read }) => async ({ key }) => {
|
|
7
|
+
try {
|
|
8
|
+
const uiSettingDto = await read(key);
|
|
9
|
+
return uiSettingDto ? toUiSettingProjection(uiSettingDto) : null;
|
|
10
|
+
}
|
|
11
|
+
catch (ignored) {
|
|
12
|
+
throw new Error("Could not fetch the uiSetting");
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export { storageUiSettingByKeyView };
|
|
@@ -3,7 +3,6 @@ import React, { useMemo } from "react";
|
|
|
3
3
|
import { View } from "react-native";
|
|
4
4
|
import { Text } from "@lookiero/aurora";
|
|
5
5
|
import { useI18n } from "@lookiero/i18n-react";
|
|
6
|
-
import { returnQuestionWithTranslationKey } from "../../../../../../../projection/returnQuestion/returnQuestion.typeguard";
|
|
7
6
|
import { DOMAIN, I18nMessages } from "../../../../../i18n/i18n";
|
|
8
7
|
import { style as hostDefaultReturnQuestionItemStyle } from "./HostDefaultReturnQuestionItem.style";
|
|
9
8
|
const HostDefaultReturnQuestionItem = ({ returnQuestion, children, }) => {
|
|
@@ -11,7 +10,7 @@ const HostDefaultReturnQuestionItem = ({ returnQuestion, children, }) => {
|
|
|
11
10
|
const isAllOptions = returnQuestion.translationKey === I18nMessages.RETURN_QUESTION_MAIN_ALL_OPINION;
|
|
12
11
|
const style = useMemo(() => hostDefaultReturnQuestionItemStyle(), []);
|
|
13
12
|
return (React.createElement(React.Fragment, null,
|
|
14
|
-
|
|
13
|
+
returnQuestion.translationKey && returnQuestion.translationKey !== " " && !isAllOptions ? (React.createElement(View, { style: style.title },
|
|
15
14
|
React.createElement(Text, { level: 3, action: true }, formatMessage({ id: returnQuestion.translationKey })))) : null,
|
|
16
15
|
children));
|
|
17
16
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
2
|
+
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
3
|
+
declare const HostLegacyRadioGroupReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.HOST_SELECT>;
|
|
4
|
+
export { HostLegacyRadioGroupReturnQuestionItem };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React, { useMemo } from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { Text } from "@lookiero/aurora";
|
|
5
|
+
import { useI18n } from "@lookiero/i18n-react";
|
|
6
|
+
import { DOMAIN } from "../../../../../i18n/i18n";
|
|
7
|
+
import { style as hostLegacyRadioGroupReturnQuestionItemStyle } from "./HostLegacyRadioGroupReturnQuestionItem.style";
|
|
8
|
+
const HostLegacyRadioGroupReturnQuestionItem = ({ returnQuestion, children, testID, }) => {
|
|
9
|
+
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
10
|
+
const placeholderText = useMemo(() => (returnQuestion.metadata.placeholder ? formatMessage({ id: returnQuestion.metadata.placeholder }) : ""), [formatMessage, returnQuestion.metadata.placeholder]);
|
|
11
|
+
const style = useMemo(() => hostLegacyRadioGroupReturnQuestionItemStyle(), []);
|
|
12
|
+
return (React.createElement(React.Fragment, null,
|
|
13
|
+
React.createElement(View, { style: style.wrapper, testID: testID },
|
|
14
|
+
React.createElement(Text, { level: 3, style: style.title, action: true }, placeholderText),
|
|
15
|
+
children)));
|
|
16
|
+
};
|
|
17
|
+
export { HostLegacyRadioGroupReturnQuestionItem };
|