@lookiero/checkout 12.2.0 → 12.4.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/cypress/integration/checkout.spec.ts +14 -9
- package/cypress/support/interceptViewCheckoutFeedbackDefinitionByCheckoutId.ts +6 -0
- package/dist/src/ExpoRoot.js +2 -2
- package/dist/src/domain/checkoutItem/model/price.d.ts +1 -1
- package/dist/src/infrastructure/delivery/baseBootstrap.d.ts +2 -2
- package/dist/src/infrastructure/delivery/baseBootstrap.js +4 -4
- package/dist/src/infrastructure/delivery/bootstrap.js +2 -2
- package/dist/src/infrastructure/delivery/bootstrap.mock.js +3 -3
- package/dist/src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock.d.ts +3 -0
- package/dist/src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock.js +107 -0
- package/dist/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.d.ts +12 -0
- package/dist/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.js +10 -0
- package/dist/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.d.ts +10 -0
- package/dist/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.js +9 -0
- package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.js +1 -1
- package/dist/src/infrastructure/projection/pricing/pricing.mock.js +1 -1
- package/dist/src/infrastructure/tracking/tracking.d.ts +1 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.d.ts +2 -2
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.js +4 -2
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestions.d.ts +2 -2
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.d.ts +5 -5
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.js +1 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/CheckoutQuestionItem.d.ts +5 -4
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +2 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.js +2 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.js +2 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.d.ts +2 -3
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.js +5 -7
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +2 -1
- package/dist/src/infrastructure/ui/views/feedback/Feedback.js +10 -9
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.d.ts +2 -3
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +17 -9
- package/dist/src/projection/checkoutFeedback/checkoutFeedback.constants.d.ts +11 -0
- package/dist/src/projection/checkoutFeedback/checkoutFeedback.constants.js +10 -0
- package/dist/src/projection/checkoutFeedback/checkoutFeedback.d.ts +22 -2
- package/dist/src/projection/checkoutFeedback/checkoutFeedback.metadata.d.ts +21 -0
- package/dist/src/projection/checkoutFeedback/checkoutFeedback.metadata.js +1 -0
- package/dist/src/projection/checkoutFeedback/checkoutFeedback.typeguards.d.ts +3 -0
- package/dist/src/projection/checkoutFeedback/checkoutFeedback.typeguards.js +7 -0
- package/dist/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.d.ts +25 -0
- package/dist/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.js +8 -0
- package/dist/src/projection/price/price.d.ts +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +5 -5
- package/src/ExpoRoot.tsx +2 -2
- package/src/domain/checkoutItem/model/price.ts +1 -1
- package/src/infrastructure/delivery/baseBootstrap.ts +9 -9
- package/src/infrastructure/delivery/bootstrap.mock.ts +5 -4
- package/src/infrastructure/delivery/bootstrap.ts +2 -2
- package/src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock.ts +110 -0
- package/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.test.ts +52 -0
- package/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.ts +30 -0
- package/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.test.ts +58 -0
- package/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.ts +25 -0
- package/src/infrastructure/projection/checkoutItem/checkoutItem.mock.ts +1 -1
- package/src/infrastructure/projection/pricing/pricing.mock.ts +1 -1
- package/src/infrastructure/tracking/tracking.ts +1 -1
- package/src/infrastructure/tracking/useTrackCheckout.test.tsx +1 -2
- package/src/infrastructure/tracking/useTrackCheckout.ts +1 -2
- package/src/infrastructure/ui/components/atoms/price/Price.test.tsx +1 -1
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.test.tsx +25 -30
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.tsx +12 -13
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestions.test.tsx +19 -26
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestions.tsx +3 -3
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.test.tsx +26 -26
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.tsx +6 -6
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/CheckoutQuestionItem.ts +5 -4
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.test.tsx +7 -11
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.tsx +6 -4
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.tsx +6 -4
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultReturnQuestionItem.test.tsx +16 -10
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.test.tsx +16 -22
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.tsx +6 -4
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.test.tsx +16 -14
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.tsx +13 -14
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.test.tsx +9 -19
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.tsx +7 -5
- package/src/infrastructure/ui/views/feedback/Feedback.test.tsx +11 -5
- package/src/infrastructure/ui/views/feedback/Feedback.tsx +10 -9
- package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.test.tsx +2 -2
- package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.tsx +20 -13
- package/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.test.tsx +1 -2
- package/src/infrastructure/ui/views/return/components/price/Price.test.tsx +1 -1
- package/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.test.tsx +1 -2
- package/src/projection/checkoutFeedback/checkoutFeedback.constants.ts +16 -0
- package/src/projection/checkoutFeedback/checkoutFeedback.metadata.ts +28 -0
- package/src/projection/checkoutFeedback/checkoutFeedback.ts +38 -2
- package/src/projection/checkoutFeedback/checkoutFeedback.typeguards.ts +13 -0
- package/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.test.ts +52 -0
- package/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.ts +61 -0
- package/src/projection/price/price.ts +1 -1
- package/cypress/support/interceptListCheckoutQuestionsByCheckoutId.ts +0 -9
- package/dist/src/domain/checkoutItem/model/currency.d.ts +0 -6
- package/dist/src/domain/checkoutItem/model/currency.js +0 -7
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.d.ts +0 -3
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.js +0 -103
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.d.ts +0 -12
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.js +0 -10
- package/dist/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.d.ts +0 -10
- package/dist/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.js +0 -9
- package/dist/src/projection/checkoutQuestion/checkoutQuestion.d.ts +0 -18
- package/dist/src/projection/checkoutQuestion/checkoutQuestion.js +0 -10
- package/dist/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.d.ts +0 -25
- package/dist/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.js +0 -8
- package/src/domain/checkoutItem/model/currency.ts +0 -7
- package/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.ts +0 -108
- package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.test.ts +0 -55
- package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.ts +0 -34
- package/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.test.ts +0 -38
- package/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.ts +0 -21
- package/src/projection/checkoutQuestion/checkoutQuestion.ts +0 -20
- package/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.test.ts +0 -31
- package/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.ts +0 -61
|
@@ -2,17 +2,17 @@ import { CheckoutStatus } from "../../src/domain/checkout/model/checkout";
|
|
|
2
2
|
import { CheckoutItemStatus } from "../../src/domain/checkoutItem/model/checkoutItem";
|
|
3
3
|
import { bookedProductsVariants } from "../../src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock";
|
|
4
4
|
import { checkout } from "../../src/infrastructure/projection/checkout/checkout.mock";
|
|
5
|
+
import { checkoutFeedbackDefinition } from "../../src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock";
|
|
5
6
|
import { checkoutItem } from "../../src/infrastructure/projection/checkoutItem/checkoutItem.mock";
|
|
6
|
-
import { checkoutQuestions } from "../../src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock";
|
|
7
7
|
import { paymentFlowPayload } from "../../src/infrastructure/projection/payment/paymentFlowPayload.mock";
|
|
8
8
|
import { pricing } from "../../src/infrastructure/projection/pricing/pricing.mock";
|
|
9
9
|
import { returnQuestions } from "../../src/infrastructure/projection/returnQuestion/returnQuestions.mock";
|
|
10
10
|
import { Routes } from "../../src/infrastructure/ui/routing/routes";
|
|
11
|
-
import {
|
|
11
|
+
import { CheckoutFeedbackQuestionType } from "../../src/projection/checkoutFeedback/checkoutFeedback.constants";
|
|
12
|
+
import { checkoutFeedbackQuestionHasChildren } from "../../src/projection/checkoutFeedback/checkoutFeedback.typeguards";
|
|
12
13
|
import { interceptBlockCheckoutBooking } from "../support/interceptBlockCheckoutBooking";
|
|
13
14
|
import { interceptGiveCheckoutFeedback } from "../support/interceptGiveCheckoutFeedback";
|
|
14
15
|
import { interceptKeepCheckoutItem } from "../support/interceptKeepCheckoutItem";
|
|
15
|
-
import { interceptListCheckoutQuestionsByCheckoutId } from "../support/interceptListCheckoutQuestionsByCheckoutId";
|
|
16
16
|
import { interceptListReturnQuestionsByCheckoutItemId } from "../support/interceptListReturnQuestionsByCheckoutItemId";
|
|
17
17
|
import { interceptPayment } from "../support/interceptPayment";
|
|
18
18
|
import { interceptReplaceCheckoutItem } from "../support/interceptReplaceCheckoutItem";
|
|
@@ -20,6 +20,7 @@ import { interceptReturnCheckoutItem } from "../support/interceptReturnCheckoutI
|
|
|
20
20
|
import { interceptSubmitCheckout } from "../support/interceptSubmitCheckout";
|
|
21
21
|
import { interceptViewBookedProductsVariantsForCheckoutItem } from "../support/interceptViewBookedProductsVariantsForCheckoutItem";
|
|
22
22
|
import { interceptViewCheckoutById } from "../support/interceptViewCheckoutById";
|
|
23
|
+
import { interceptViewCheckoutFeedbackDefinitionByCheckoutId } from "../support/interceptViewCheckoutFeedbackDefinitionByCheckoutId";
|
|
23
24
|
import { interceptViewFirstAvailableCheckoutByCustomerId } from "../support/interceptViewFirstAvailableCheckoutByCustomerId";
|
|
24
25
|
import { interceptViewFiveItemsDiscountByCustomerId } from "../support/interceptViewFiveItemsDiscountByCustomerId";
|
|
25
26
|
import { interceptViewIsSizeChangeEnabledByCheckoutId } from "../support/interceptViewIsSizeChangeEnabledByCheckoutId";
|
|
@@ -79,17 +80,21 @@ const checkoutFeedback = () => {
|
|
|
79
80
|
cy.shouldIncludePathInUrl(`${BASEPATH}/${Routes.FEEDBACK}`);
|
|
80
81
|
|
|
81
82
|
const answers = [];
|
|
82
|
-
|
|
83
|
-
if (checkoutQuestion
|
|
83
|
+
checkoutFeedbackDefinition.map((checkoutQuestion) => {
|
|
84
|
+
if (checkoutFeedbackQuestionHasChildren(checkoutQuestion)) {
|
|
84
85
|
const index = randomIndex(checkoutQuestion.children.length);
|
|
85
86
|
const randomCheckoutQuestionItem = checkoutQuestion.children[index];
|
|
86
87
|
answers.push(randomCheckoutQuestionItem.id);
|
|
87
88
|
|
|
88
89
|
if (
|
|
89
|
-
|
|
90
|
-
checkoutQuestion
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
!checkoutQuestion?.metadata?.showCondition ||
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
checkoutQuestion?.metadata?.showCondition.length === 0 ||
|
|
94
|
+
// @ts-ignore
|
|
95
|
+
checkoutQuestion?.metadata?.showCondition.some((condition) => answers.includes(condition))
|
|
91
96
|
) {
|
|
92
|
-
if (checkoutQuestion.type ===
|
|
97
|
+
if (checkoutQuestion.type === CheckoutFeedbackQuestionType.HOST_TEXTAREA) {
|
|
93
98
|
cy.getByTestId(randomCheckoutQuestionItem.id).type("Cypress E2E test");
|
|
94
99
|
} else {
|
|
95
100
|
cy.getByTestId(randomCheckoutQuestionItem.id).click();
|
|
@@ -125,7 +130,7 @@ describe("Checkout", () => {
|
|
|
125
130
|
interceptListReturnQuestionsByCheckoutItemId(returnQuestions);
|
|
126
131
|
interceptViewPricingByCheckoutId(pricing());
|
|
127
132
|
interceptViewPaymentFlowPayloadByCheckoutId(paymentFlowPayload);
|
|
128
|
-
|
|
133
|
+
interceptViewCheckoutFeedbackDefinitionByCheckoutId(checkoutFeedbackDefinition);
|
|
129
134
|
|
|
130
135
|
interceptKeepCheckoutItem();
|
|
131
136
|
interceptReplaceCheckoutItem();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CheckoutFeedbackQuestionProjection } from "../../src/projection/checkoutFeedback/checkoutFeedback";
|
|
2
|
+
|
|
3
|
+
const interceptViewCheckoutFeedbackDefinitionByCheckoutId = (response: CheckoutFeedbackQuestionProjection[]) =>
|
|
4
|
+
cy.intercept({ method: "POST", url: "/local-to-dev/view-checkout-feedback-definition-by-checkout-id" }, response);
|
|
5
|
+
|
|
6
|
+
export { interceptViewCheckoutFeedbackDefinitionByCheckoutId };
|
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: "8fc50dda-26b8-4a14-b2bf-7f4f9541f9bd",
|
|
32
32
|
country: Country.NL,
|
|
33
33
|
segment: Segment.WOMEN,
|
|
34
34
|
email: "email@example.com",
|
|
@@ -45,7 +45,7 @@ const apiUrl = Platform.OS !== "web"
|
|
|
45
45
|
: __DEV__
|
|
46
46
|
? "/local-to-dev"
|
|
47
47
|
: "/checkout/api";
|
|
48
|
-
const authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.
|
|
48
|
+
const authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU5OTQwMTcsImV4cCI6MTc1MjE0NDQ2MywiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjUtMDYtMTAiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiOGZjNTBkZGEtMjZiOC00YTE0LWIyYmYtN2Y0Zjk1NDFmOWJkIiwidHJhZGVuYW1lIjoiTE9PS0lFUk8iLCJpYXQiOjE3NDk1NTI0NjN9.xFDOdP0an_ki8_JsvTANVDxPXWs0iWpTs1EFMqCrbO8";
|
|
49
49
|
const getAuthToken = () => Promise.resolve(authToken);
|
|
50
50
|
const externalTranslationsUrl = Platform.OS !== "web"
|
|
51
51
|
? "https://backend-for-user.dev.envs.lookiero.tech/api/v2/translations"
|
|
@@ -15,8 +15,8 @@ import { FiveItemsDiscountByCustomerIdView } from "../../projection/checkout/vie
|
|
|
15
15
|
import { IsCheckoutEnabledByCustomerIdView } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
|
|
16
16
|
import { IsSizeChangeEnabledByCheckoutIdView } from "../../projection/checkout/viewIsSizeChangeEnabledByCheckoutId";
|
|
17
17
|
import { CheckoutBookingByIdView } from "../../projection/checkoutBooking/viewCheckoutBookingById";
|
|
18
|
+
import { CheckoutFeedbackDefinitionByCheckoutIdView } from "../../projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId";
|
|
18
19
|
import { CheckoutItemByIdView } from "../../projection/checkoutItem/viewCheckoutItemById";
|
|
19
|
-
import { CheckoutQuestionsByCheckoutIdView } from "../../projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId";
|
|
20
20
|
import { PaymentFlowPayloadByCheckoutIdView } from "../../projection/payment/viewPaymentFlowPayloadByCheckoutId";
|
|
21
21
|
import { PricingByCheckoutIdView } from "../../projection/pricing/viewPricingByCheckoutId";
|
|
22
22
|
import { ReturnQuestionsByCheckoutItemIdView } from "../../projection/returnQuestion/listReturnQuestionsByCheckoutItemId";
|
|
@@ -35,7 +35,7 @@ interface BaseBootstrapFunctionArgs<CheckoutGetFunctionArgs extends RepositoryGe
|
|
|
35
35
|
readonly bookedProductsVariantsForCheckoutItemView: BookedProductsVariantsForCheckoutItemView;
|
|
36
36
|
readonly pricingByCheckoutIdView: PricingByCheckoutIdView;
|
|
37
37
|
readonly paymentFlowPayloadByCheckoutIdView: PaymentFlowPayloadByCheckoutIdView;
|
|
38
|
-
readonly
|
|
38
|
+
readonly checkoutFeedbackDefinitionByCheckoutIdView: CheckoutFeedbackDefinitionByCheckoutIdView;
|
|
39
39
|
readonly getCheckout: CheckoutsGetFunction<CheckoutGetFunctionArgs>;
|
|
40
40
|
readonly saveCheckout: CheckoutsSaveFunction<CheckoutSaveFunctionArgs>;
|
|
41
41
|
readonly checkoutsDependencies: NeverWhenEmptyRecord<[
|
|
@@ -27,13 +27,13 @@ import { viewFiveItemsDiscountByCustomerIdHandler, VIEW_FIVE_ITEMS_DISCOUNT_BY_C
|
|
|
27
27
|
import { viewIsCheckoutEnabledByCustomerIdHandler, VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
|
|
28
28
|
import { viewIsSizeChangeEnabledByCheckoutIdHandler, VIEW_IS_SIZE_CHANGE_ENABLED_BY_CHECKOUT_ID, } from "../../projection/checkout/viewIsSizeChangeEnabledByCheckoutId";
|
|
29
29
|
import { viewCheckoutBookingByIdHandler, VIEW_CHECKOUT_BOOKING_BY_ID, } from "../../projection/checkoutBooking/viewCheckoutBookingById";
|
|
30
|
+
import { viewCheckoutFeedbackDefinitionByCheckoutIdHandler, VIEW_CHECKOUT_FEEDBACK_DEFINITION_BY_CHECKOUT_ID, } from "../../projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId";
|
|
30
31
|
import { viewCheckoutItemByIdHandler, VIEW_CHECKOUT_ITEM_BY_ID, } from "../../projection/checkoutItem/viewCheckoutItemById";
|
|
31
|
-
import { listCheckoutQuestionsByCheckoutIdHandler, LIST_CHECKOUT_QUESTIONS_BY_CHECKOUT_ID, } from "../../projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId";
|
|
32
32
|
import { viewPaymentFlowPayloadByCheckoutIdHandler, VIEW_PAYMENT_FLOW_PAYLOAD_BY_CHECKOUT_ID, } from "../../projection/payment/viewPaymentFlowPayloadByCheckoutId";
|
|
33
33
|
import { viewPricingByCheckoutIdHandler, VIEW_PRICING_BY_CHECKOUT_ID, } from "../../projection/pricing/viewPricingByCheckoutId";
|
|
34
34
|
import { listReturnQuestionsByCheckoutItemIdHandler, LIST_RETURN_QUESTIONS_BY_CHECKOUT_ITEM_ID, } from "../../projection/returnQuestion/listReturnQuestionsByCheckoutItemId";
|
|
35
35
|
const MESSAGING_CONTEXT_ID = "Checkout";
|
|
36
|
-
const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, isSizeChangeEnabledByCheckoutIdView, fiveItemsDiscountByCustomerIdView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView, bookedProductsVariantsForCheckoutItemView, checkoutBookingByIdView, pricingByCheckoutIdView, paymentFlowPayloadByCheckoutIdView,
|
|
36
|
+
const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, isSizeChangeEnabledByCheckoutIdView, fiveItemsDiscountByCustomerIdView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView, bookedProductsVariantsForCheckoutItemView, checkoutBookingByIdView, pricingByCheckoutIdView, paymentFlowPayloadByCheckoutIdView, checkoutFeedbackDefinitionByCheckoutIdView, getCheckout, saveCheckout, checkoutsDependencies, getCheckoutItem, saveCheckoutItem, checkoutItemsDependencies, getCheckoutBooking, saveCheckoutBooking, checkoutBookingsDependencies, getCheckoutFeedback, saveCheckoutFeedback, checkoutFeedbacksDependencies, }) => {
|
|
37
37
|
let messaging = messagingBootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
38
38
|
.query(VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, viewFiveItemsDiscountByCustomerIdHandler, {
|
|
39
39
|
view: fiveItemsDiscountByCustomerIdView,
|
|
@@ -68,8 +68,8 @@ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdVie
|
|
|
68
68
|
.query(VIEW_PAYMENT_FLOW_PAYLOAD_BY_CHECKOUT_ID, viewPaymentFlowPayloadByCheckoutIdHandler, {
|
|
69
69
|
view: paymentFlowPayloadByCheckoutIdView,
|
|
70
70
|
})
|
|
71
|
-
.query(
|
|
72
|
-
view:
|
|
71
|
+
.query(VIEW_CHECKOUT_FEEDBACK_DEFINITION_BY_CHECKOUT_ID, viewCheckoutFeedbackDefinitionByCheckoutIdHandler, {
|
|
72
|
+
view: checkoutFeedbackDefinitionByCheckoutIdView,
|
|
73
73
|
})
|
|
74
74
|
.query(VIEW_CHECKOUT_BOOKING_BY_ID, viewCheckoutBookingByIdHandler, {
|
|
75
75
|
view: checkoutBookingByIdView,
|
|
@@ -12,8 +12,8 @@ import { httpFiveItemsDiscountByCustomerIdView } from "../projection/checkout/ht
|
|
|
12
12
|
import { httpIsCheckoutEnabledByCustomerIdView } from "../projection/checkout/httpIsCheckoutEnabledByCustomerIdView";
|
|
13
13
|
import { httpIsSizeChangeEnabledByCheckoutIdView } from "../projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView";
|
|
14
14
|
import { httpCheckoutBookingByIdView } from "../projection/checkoutBooking/httpCheckoutBookingByIdView";
|
|
15
|
+
import { httpCheckoutFeedbackDefinitionByCheckoutIdView } from "../projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView";
|
|
15
16
|
import { httpCheckoutItemByIdView } from "../projection/checkoutItem/httpCheckoutItemByIdView";
|
|
16
|
-
import { httpCheckoutQuestionsByCheckoutIdView } from "../projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView";
|
|
17
17
|
import { httpPaymentFlowPayloadByCheckoutIdView } from "../projection/payment/httpPaymentFlowPayloadByCheckoutIdView";
|
|
18
18
|
import { httpPricingByCheckoutIdView } from "../projection/pricing/httpPricingByCheckoutIdView";
|
|
19
19
|
import { httpReturnQuestionsByCheckoutItemIdView } from "../projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView";
|
|
@@ -40,7 +40,7 @@ const bootstrap = ({ apiUrl, getAuthToken }) => {
|
|
|
40
40
|
paymentFlowPayloadByCheckoutIdView: httpPaymentFlowPayloadByCheckoutIdView({
|
|
41
41
|
httpPost,
|
|
42
42
|
}),
|
|
43
|
-
|
|
43
|
+
checkoutFeedbackDefinitionByCheckoutIdView: httpCheckoutFeedbackDefinitionByCheckoutIdView({
|
|
44
44
|
httpPost,
|
|
45
45
|
}),
|
|
46
46
|
getCheckout,
|
|
@@ -3,7 +3,7 @@ import { bookedProductsVariants } from "../projection/bookedProductsVariants/boo
|
|
|
3
3
|
import { checkout } from "../projection/checkout/checkout.mock";
|
|
4
4
|
import { checkoutBooking as checkoutBookingMock } from "../projection/checkoutBooking/checkoutBooking.mock";
|
|
5
5
|
import { checkoutFeedback as checkoutFeedbackMock } from "../projection/checkoutFeedback/checkoutFeedback.mock";
|
|
6
|
-
import {
|
|
6
|
+
import { checkoutFeedbackDefinition as checkoutFeedbackDefinitionMock } from "../projection/checkoutFeedback/checkoutFeedbackDefinition.mock";
|
|
7
7
|
import { feedback as feedbackMock } from "../projection/feedback/feedback.mock";
|
|
8
8
|
import { paymentFlowPayload as paymentFlowPayloadMock } from "../projection/payment/paymentFlowPayload.mock";
|
|
9
9
|
import { pricing as pricingMock } from "../projection/pricing/pricing.mock";
|
|
@@ -54,7 +54,7 @@ const checkoutBookingByIdView = async () => checkoutBookingMock;
|
|
|
54
54
|
const bookedProductsVariantsForCheckoutItemView = async () => bookedProductsVariants;
|
|
55
55
|
const pricingByCheckoutIdView = async () => pricingMock();
|
|
56
56
|
const paymentFlowPayloadByCheckoutIdView = async () => paymentFlowPayloadMock;
|
|
57
|
-
const
|
|
57
|
+
const checkoutFeedbackDefinitionByCheckoutIdView = async () => checkoutFeedbackDefinitionMock;
|
|
58
58
|
const bootstrap = () => baseBootstrap({
|
|
59
59
|
checkoutByIdView,
|
|
60
60
|
firstAvailableCheckoutByCustomerIdView,
|
|
@@ -67,7 +67,7 @@ const bootstrap = () => baseBootstrap({
|
|
|
67
67
|
bookedProductsVariantsForCheckoutItemView,
|
|
68
68
|
pricingByCheckoutIdView,
|
|
69
69
|
paymentFlowPayloadByCheckoutIdView,
|
|
70
|
-
|
|
70
|
+
checkoutFeedbackDefinitionByCheckoutIdView,
|
|
71
71
|
getCheckout,
|
|
72
72
|
saveCheckout,
|
|
73
73
|
checkoutsDependencies: [{ dataSource }],
|
package/dist/src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { CheckoutFeedbackQuestionType } from "../../../projection/checkoutFeedback/checkoutFeedback.constants";
|
|
2
|
+
const checkoutFeedbackDefinition = [
|
|
3
|
+
{
|
|
4
|
+
id: "efe07b97-f6fb-4b6a-ba92-b68519320b2c",
|
|
5
|
+
translationKey: "checkout_question.selection.question",
|
|
6
|
+
type: CheckoutFeedbackQuestionType.HOST_SELECT,
|
|
7
|
+
metadata: {
|
|
8
|
+
placeholder: "checkout_question.selection.placeholder",
|
|
9
|
+
showCondition: [],
|
|
10
|
+
},
|
|
11
|
+
children: [
|
|
12
|
+
{
|
|
13
|
+
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
14
|
+
type: CheckoutFeedbackQuestionType.ICON,
|
|
15
|
+
metadata: {
|
|
16
|
+
icon: "checkout_feedback.icon.bad",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
21
|
+
type: CheckoutFeedbackQuestionType.ICON,
|
|
22
|
+
metadata: {
|
|
23
|
+
icon: "checkout_feedback.icon.regular",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
28
|
+
type: CheckoutFeedbackQuestionType.ICON,
|
|
29
|
+
metadata: {
|
|
30
|
+
icon: "checkout_feedback.icon.good",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "6a6d3878-5561-412c-96f3-7ed79ee587bb",
|
|
37
|
+
translationKey: "checkout_question.experience.question",
|
|
38
|
+
type: CheckoutFeedbackQuestionType.HOST_SELECT,
|
|
39
|
+
metadata: {
|
|
40
|
+
placeholder: "checkout_question.experience.placeholder",
|
|
41
|
+
showCondition: [],
|
|
42
|
+
},
|
|
43
|
+
children: [
|
|
44
|
+
{
|
|
45
|
+
id: "a3d937b6-7499-4a3c-86bf-5c0af9ab2e23",
|
|
46
|
+
type: CheckoutFeedbackQuestionType.ICON,
|
|
47
|
+
metadata: {
|
|
48
|
+
icon: "checkout_feedback.icon.bad",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "7970edd3-fb5c-42d3-afe3-ce31bcbb856c",
|
|
53
|
+
type: CheckoutFeedbackQuestionType.ICON,
|
|
54
|
+
metadata: {
|
|
55
|
+
icon: "checkout_feedback.icon.regular",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "bab3d4f9-0227-4550-a53f-3c125d68429c",
|
|
60
|
+
type: CheckoutFeedbackQuestionType.ICON,
|
|
61
|
+
metadata: {
|
|
62
|
+
icon: "checkout_feedback.icon.good",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "a1acdb2d-62c8-467f-b7cc-dc24d967290c",
|
|
69
|
+
translationKey: "checkout_question.personalshopper.question",
|
|
70
|
+
type: CheckoutFeedbackQuestionType.HOST_SELECT,
|
|
71
|
+
metadata: {
|
|
72
|
+
showCondition: ["68c0bb98-b00a-4b86-af43-528fe903cb69"],
|
|
73
|
+
placeholder: "checkout_question.personalshopper.placeholder",
|
|
74
|
+
},
|
|
75
|
+
children: [
|
|
76
|
+
{
|
|
77
|
+
id: "cce7851c-92c7-461b-8dcb-903c5de59ed1",
|
|
78
|
+
translationKey: "checkout_question.personalshopper.yes",
|
|
79
|
+
type: CheckoutFeedbackQuestionType.BUTTON,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "4bf8f27d-669b-4d36-8d39-b5599c671816",
|
|
83
|
+
translationKey: "checkout_question.personalshopper.no",
|
|
84
|
+
type: CheckoutFeedbackQuestionType.BUTTON,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: "ce3e8d57-5eea-4dd3-bef4-2e811a143612",
|
|
90
|
+
translationKey: "checkout_question.comment.question",
|
|
91
|
+
type: CheckoutFeedbackQuestionType.HOST_TEXTAREA,
|
|
92
|
+
metadata: {
|
|
93
|
+
showCondition: [],
|
|
94
|
+
},
|
|
95
|
+
children: [
|
|
96
|
+
{
|
|
97
|
+
id: "1123a37d-bc00-43a4-9d28-cee1dfaf356c",
|
|
98
|
+
translationKey: "checkout_question.comment.question",
|
|
99
|
+
type: CheckoutFeedbackQuestionType.TEXTAREA,
|
|
100
|
+
metadata: {
|
|
101
|
+
placeholder: "checkout_question.comment.placeholder",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
export { checkoutFeedbackDefinition };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HttpPostFunction } from "@lookiero/sty-psp-http";
|
|
2
|
+
import { CheckoutFeedbackDefinitionByCheckoutIdView } from "../../../projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId";
|
|
3
|
+
interface HttpCheckoutFeedbackDefinitionByCheckoutIdView extends CheckoutFeedbackDefinitionByCheckoutIdView {
|
|
4
|
+
}
|
|
5
|
+
interface HttpCheckoutFeedbackDefinitionByCheckoutIdViewFunctionArgs {
|
|
6
|
+
readonly httpPost: HttpPostFunction;
|
|
7
|
+
}
|
|
8
|
+
interface HttpCheckoutFeedbackDefinitionByCheckoutIdViewFunction {
|
|
9
|
+
(args: HttpCheckoutFeedbackDefinitionByCheckoutIdViewFunctionArgs): HttpCheckoutFeedbackDefinitionByCheckoutIdView;
|
|
10
|
+
}
|
|
11
|
+
declare const httpCheckoutFeedbackDefinitionByCheckoutIdView: HttpCheckoutFeedbackDefinitionByCheckoutIdViewFunction;
|
|
12
|
+
export { httpCheckoutFeedbackDefinitionByCheckoutIdView };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const httpCheckoutFeedbackDefinitionByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => await httpPost({
|
|
2
|
+
endpoint: "/view-checkout-feedback-definition-by-checkout-id",
|
|
3
|
+
body: { checkoutId },
|
|
4
|
+
signal,
|
|
5
|
+
result: {
|
|
6
|
+
error: null,
|
|
7
|
+
success: (response) => response,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export { httpCheckoutFeedbackDefinitionByCheckoutIdView };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
|
+
import { CheckoutFeedbackQuestionProjection } from "../../../../projection/checkoutFeedback/checkoutFeedback";
|
|
3
|
+
interface UseViewCheckoutFeedbackDefinitionByCheckoutIdFunctionArgs {
|
|
4
|
+
readonly checkoutId: string;
|
|
5
|
+
}
|
|
6
|
+
interface UseViewCheckoutFeedbackDefinitionByCheckoutIdFunction {
|
|
7
|
+
(args: UseViewCheckoutFeedbackDefinitionByCheckoutIdFunctionArgs): UseQueryFunctionResult<CheckoutFeedbackQuestionProjection[]>;
|
|
8
|
+
}
|
|
9
|
+
declare const useViewCheckoutFeedbackDefinitionByCheckoutId: UseViewCheckoutFeedbackDefinitionByCheckoutIdFunction;
|
|
10
|
+
export { useViewCheckoutFeedbackDefinitionByCheckoutId };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
+
import { viewCheckoutFeedbackDefinitionByCheckoutId } from "../../../../projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId";
|
|
3
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
4
|
+
const useViewCheckoutFeedbackDefinitionByCheckoutId = ({ checkoutId, }) => useQuery({
|
|
5
|
+
query: viewCheckoutFeedbackDefinitionByCheckoutId({ checkoutId }),
|
|
6
|
+
contextId: MESSAGING_CONTEXT_ID,
|
|
7
|
+
options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
8
|
+
});
|
|
9
|
+
export { useViewCheckoutFeedbackDefinitionByCheckoutId };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Currency } from "
|
|
1
|
+
import { Currency } from "@lookiero/sty-psp-locale";
|
|
2
2
|
import { MediaPerspective, } from "../../../projection/checkoutItem/checkoutItem";
|
|
3
3
|
const checkoutItem = ({ id = "7b389d69-f157-4234-8531-c1a1eb17dccb", status, feedbacks = {}, replacedFor = null, }) => ({
|
|
4
4
|
id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Currency } from "@lookiero/sty-psp-locale";
|
|
1
2
|
import { BaseTrackingEvent, TrackingEventCategory } from "@lookiero/sty-psp-tracking";
|
|
2
3
|
import { CheckoutItemStatus } from "../../domain/checkoutItem/model/checkoutItem";
|
|
3
|
-
import { Currency } from "../../domain/checkoutItem/model/currency";
|
|
4
4
|
import { MediaPerspective } from "../../projection/checkoutItem/checkoutItem";
|
|
5
5
|
import { SubscriptionProjection } from "../../projection/subscription/subscription";
|
|
6
6
|
declare const PROJECT = "checkout";
|
package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { CheckoutFeedbackQuestionProjection } from "../../../../../projection/checkoutFeedback/checkoutFeedback";
|
|
3
3
|
interface CheckoutQuestionProps {
|
|
4
4
|
readonly checkoutQuestionParentId: string;
|
|
5
|
-
readonly checkoutQuestion:
|
|
5
|
+
readonly checkoutQuestion: CheckoutFeedbackQuestionProjection;
|
|
6
6
|
}
|
|
7
7
|
declare const _default: React.NamedExoticComponent<CheckoutQuestionProps>;
|
|
8
8
|
export default _default;
|
package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React, { memo } from "react";
|
|
2
|
+
import { checkoutFeedbackQuestionHasChildren } from "../../../../../projection/checkoutFeedback/checkoutFeedback.typeguards";
|
|
2
3
|
import { useCheckoutQuestionItem } from "./behaviors/useCheckoutQuestionItem";
|
|
3
|
-
const CheckoutQuestion = ({ checkoutQuestion, checkoutQuestionParentId
|
|
4
|
+
const CheckoutQuestion = ({ checkoutQuestion, checkoutQuestionParentId }) => {
|
|
4
5
|
const Item = useCheckoutQuestionItem({ type: checkoutQuestion.type });
|
|
5
|
-
return (React.createElement(Item, { checkoutQuestion: checkoutQuestion, checkoutQuestionParentId: checkoutQuestionParentId, testID: checkoutQuestion.id }, checkoutQuestion
|
|
6
|
+
return (React.createElement(Item, { checkoutQuestion: checkoutQuestion, checkoutQuestionParentId: checkoutQuestionParentId, testID: checkoutQuestion.id }, checkoutFeedbackQuestionHasChildren(checkoutQuestion) &&
|
|
7
|
+
checkoutQuestion.children.map((childCheckoutQuestion) => (React.createElement(CheckoutQuestion, { key: childCheckoutQuestion.id, checkoutQuestion: childCheckoutQuestion, checkoutQuestionParentId: checkoutQuestion.id })))));
|
|
6
8
|
};
|
|
7
9
|
export default memo(CheckoutQuestion);
|
package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestions.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { CheckoutFeedbackQuestionProjection } from "../../../../../projection/checkoutFeedback/checkoutFeedback";
|
|
3
3
|
interface CheckoutQuestionsProps {
|
|
4
|
-
readonly checkoutQuestions:
|
|
4
|
+
readonly checkoutQuestions: CheckoutFeedbackQuestionProjection[];
|
|
5
5
|
}
|
|
6
6
|
declare const CheckoutQuestions: FC<CheckoutQuestionsProps>;
|
|
7
7
|
export { CheckoutQuestions };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { FC, ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { CheckoutFeedbackQuestionType } from "../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
|
|
3
3
|
import { CheckoutQuestionItem } from "../components/CheckoutQuestionItem";
|
|
4
|
-
type CheckoutQuestionItems = Record<
|
|
4
|
+
type CheckoutQuestionItems = Record<CheckoutFeedbackQuestionType, CheckoutQuestionItem<CheckoutFeedbackQuestionType>>;
|
|
5
5
|
interface CheckoutQuestionItemContextProviderProps {
|
|
6
6
|
readonly checkoutQuestionItems: CheckoutQuestionItems;
|
|
7
7
|
readonly children: ReactNode;
|
|
8
8
|
}
|
|
9
9
|
declare const CheckoutQuestionItemProvider: FC<CheckoutQuestionItemContextProviderProps>;
|
|
10
|
-
interface UseCheckoutQuestionItemFunctionArgs {
|
|
11
|
-
readonly type:
|
|
10
|
+
interface UseCheckoutQuestionItemFunctionArgs<QT extends CheckoutFeedbackQuestionType> {
|
|
11
|
+
readonly type: QT;
|
|
12
12
|
}
|
|
13
13
|
interface UseCheckoutQuestionItemFunction {
|
|
14
|
-
(args: UseCheckoutQuestionItemFunctionArgs): CheckoutQuestionItem
|
|
14
|
+
<QT extends CheckoutFeedbackQuestionType>(args: UseCheckoutQuestionItemFunctionArgs<QT>): CheckoutQuestionItem<QT>;
|
|
15
15
|
}
|
|
16
16
|
declare const useCheckoutQuestionItem: UseCheckoutQuestionItemFunction;
|
|
17
17
|
export type { CheckoutQuestionItems };
|
|
@@ -6,7 +6,7 @@ const useCheckoutQuestionItem = ({ type }) => {
|
|
|
6
6
|
const items = useContext(CheckoutQuestionItemContext);
|
|
7
7
|
const item = useMemo(() => items[type], [items, type]);
|
|
8
8
|
invariant(items, "Your are trying to use the useCheckoutQuestionItem hook without wrapping your app with the <CheckoutQuestionItemProvider>.");
|
|
9
|
-
invariant(item, `The provided
|
|
9
|
+
invariant(item, `The provided CheckoutFeedbackQuestionType (${type}) is NOT SUPPORTED`);
|
|
10
10
|
return item;
|
|
11
11
|
};
|
|
12
12
|
export { useCheckoutQuestionItem, CheckoutQuestionItemProvider };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { FC, ReactNode } from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { CheckoutFeedbackQuestionProjection } from "../../../../../../projection/checkoutFeedback/checkoutFeedback";
|
|
3
|
+
import { CheckoutFeedbackQuestionType } from "../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
|
|
4
|
+
interface CheckoutQuestionItemProps<CFQT extends CheckoutFeedbackQuestionType> {
|
|
5
|
+
readonly checkoutQuestion: CheckoutFeedbackQuestionProjection<CFQT>;
|
|
5
6
|
readonly checkoutQuestionParentId: string;
|
|
6
7
|
readonly children?: ReactNode;
|
|
7
8
|
readonly portalHostName?: string;
|
|
8
9
|
readonly testID?: string;
|
|
9
10
|
}
|
|
10
|
-
type CheckoutQuestionItem = FC<CheckoutQuestionItemProps
|
|
11
|
+
type CheckoutQuestionItem<CFQT extends CheckoutFeedbackQuestionType> = FC<CheckoutQuestionItemProps<CFQT>>;
|
|
11
12
|
export type { CheckoutQuestionItem, CheckoutQuestionItemProps };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CheckoutFeedbackQuestionType } from "../../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
|
|
1
2
|
import { CheckoutQuestionItem } from "../CheckoutQuestionItem";
|
|
2
|
-
declare const ButtonCheckoutQuestionItem: CheckoutQuestionItem
|
|
3
|
+
declare const ButtonCheckoutQuestionItem: CheckoutQuestionItem<CheckoutFeedbackQuestionType.BUTTON>;
|
|
3
4
|
export { ButtonCheckoutQuestionItem };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import React, { useCallback, useMemo } from "react";
|
|
2
3
|
import { TouchableOpacity } from "react-native";
|
|
3
4
|
import { Text } from "@lookiero/aurora";
|
|
@@ -8,7 +9,7 @@ import { style as buttonCheckoutQuestionItemStyle } from "./ButtonCheckoutQuesti
|
|
|
8
9
|
const ACTIVE_OPACITY = 0.6;
|
|
9
10
|
const ButtonCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, testID, }) => {
|
|
10
11
|
const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
|
|
11
|
-
const optionText = useI18nMessage({ domain: DOMAIN, id: checkoutQuestion.
|
|
12
|
+
const optionText = useI18nMessage({ domain: DOMAIN, id: checkoutQuestion.translationKey });
|
|
12
13
|
const handleOnPress = useCallback(() => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: checkoutQuestion.id }), [onChange, checkoutQuestion.id, checkoutQuestionParentId]);
|
|
13
14
|
const style = useMemo(() => buttonCheckoutQuestionItemStyle(), []);
|
|
14
15
|
const checked = feedback === checkoutQuestion.id;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CheckoutFeedbackQuestionType } from "../../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
|
|
1
2
|
import { CheckoutQuestionItem } from "../CheckoutQuestionItem";
|
|
2
|
-
declare const HostDefaultCheckoutQuestionItem: CheckoutQuestionItem
|
|
3
|
+
declare const HostDefaultCheckoutQuestionItem: CheckoutQuestionItem<CheckoutFeedbackQuestionType.HOST_DEFAULT>;
|
|
3
4
|
export { HostDefaultCheckoutQuestionItem };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import React, { useMemo } from "react";
|
|
2
3
|
import { View } from "react-native";
|
|
3
4
|
import { Text } from "@lookiero/aurora";
|
|
@@ -5,7 +6,7 @@ import { useI18nMessage } from "@lookiero/i18n-react";
|
|
|
5
6
|
import { DOMAIN } from "../../../../../i18n/i18n";
|
|
6
7
|
import { style as hostDefaultCheckoutQuestionItemStyle } from "./HostDefaultCheckoutQuestionItem.style";
|
|
7
8
|
const HostDefaultCheckoutQuestionItem = ({ checkoutQuestion, children, }) => {
|
|
8
|
-
const titleText = useI18nMessage({ domain: DOMAIN, id: checkoutQuestion.
|
|
9
|
+
const titleText = useI18nMessage({ domain: DOMAIN, id: checkoutQuestion.translationKey });
|
|
9
10
|
const style = useMemo(() => hostDefaultCheckoutQuestionItemStyle(), []);
|
|
10
11
|
return (React.createElement(React.Fragment, null,
|
|
11
12
|
React.createElement(Text, { level: 3, style: style.title }, titleText),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CheckoutFeedbackQuestionType } from "../../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
|
|
1
2
|
import { CheckoutQuestionItem } from "../CheckoutQuestionItem";
|
|
2
|
-
declare const HostSelectCheckoutQuestionItem: CheckoutQuestionItem
|
|
3
|
+
declare const HostSelectCheckoutQuestionItem: CheckoutQuestionItem<CheckoutFeedbackQuestionType.HOST_SELECT>;
|
|
3
4
|
export { HostSelectCheckoutQuestionItem };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import React, { useMemo } from "react";
|
|
2
3
|
import { View } from "react-native";
|
|
3
4
|
import { Text } from "@lookiero/aurora";
|
|
@@ -5,7 +6,7 @@ import { useI18nMessage } from "@lookiero/i18n-react";
|
|
|
5
6
|
import { DOMAIN } from "../../../../../i18n/i18n";
|
|
6
7
|
import { style as hostSelectCheckoutQuestionItemStyle } from "./HostSelectCheckoutQuestionItem.style";
|
|
7
8
|
const HostSelectCheckoutQuestionItem = ({ checkoutQuestion, children, }) => {
|
|
8
|
-
const titleText = useI18nMessage({ domain: DOMAIN, id: checkoutQuestion.
|
|
9
|
+
const titleText = useI18nMessage({ domain: DOMAIN, id: checkoutQuestion.translationKey });
|
|
9
10
|
const style = useMemo(() => hostSelectCheckoutQuestionItemStyle(), []);
|
|
10
11
|
return (React.createElement(React.Fragment, null,
|
|
11
12
|
React.createElement(Text, { level: 3, style: style.title }, titleText),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
+
import { CheckoutFeedbackQuestionType } from "../../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
|
|
1
2
|
import { CheckoutQuestionItem } from "../CheckoutQuestionItem";
|
|
2
|
-
|
|
3
|
-
declare const IconCheckoutQuestionItem: CheckoutQuestionItem;
|
|
4
|
-
export type { IconName };
|
|
3
|
+
declare const IconCheckoutQuestionItem: CheckoutQuestionItem<CheckoutFeedbackQuestionType.ICON>;
|
|
5
4
|
export { IconCheckoutQuestionItem };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import React, { useCallback, useMemo } from "react";
|
|
2
3
|
import { Pressable } from "react-native";
|
|
3
4
|
import invariant from "tiny-invariant";
|
|
@@ -7,15 +8,12 @@ import { Happy } from "./icons/Happy";
|
|
|
7
8
|
import { Normal } from "./icons/Normal";
|
|
8
9
|
import { Sad } from "./icons/Sad";
|
|
9
10
|
const ICON = {
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
"checkout_question.icon.regular": Normal,
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
15
|
-
"checkout_question.icon.good": Happy,
|
|
11
|
+
["checkout_feedback.icon.bad"]: Sad,
|
|
12
|
+
["checkout_feedback.icon.regular"]: Normal,
|
|
13
|
+
["checkout_feedback.icon.good"]: Happy,
|
|
16
14
|
};
|
|
17
15
|
const IconCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, testID, }) => {
|
|
18
|
-
const Icon = ICON[checkoutQuestion.
|
|
16
|
+
const Icon = ICON[checkoutQuestion.metadata.icon];
|
|
19
17
|
const style = useMemo(() => iconCheckoutQuestionItemStyle(), []);
|
|
20
18
|
const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
|
|
21
19
|
const isSelected = feedback === checkoutQuestion.id;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CheckoutFeedbackQuestionType } from "../../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
|
|
1
2
|
import { CheckoutQuestionItem } from "../CheckoutQuestionItem";
|
|
2
|
-
declare const TextareaCheckoutQuestionItem: CheckoutQuestionItem
|
|
3
|
+
declare const TextareaCheckoutQuestionItem: CheckoutQuestionItem<CheckoutFeedbackQuestionType.TEXTAREA>;
|
|
3
4
|
export { TextareaCheckoutQuestionItem };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import React, { useCallback, useMemo } from "react";
|
|
2
3
|
import { useI18n } from "@lookiero/i18n-react";
|
|
3
4
|
import { InputField, TextInput } from "@lookiero/sty-psp-ui";
|
|
@@ -6,7 +7,7 @@ import { useCheckoutQuestionFeedbackForId } from "../../behaviors/useCheckoutQue
|
|
|
6
7
|
import { style as textareaCheckoutQuestionItemStyle } from "./TextareaCheckoutQuestionItem.style";
|
|
7
8
|
const TextareaCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, testID, }) => {
|
|
8
9
|
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
9
|
-
const placeholderText = useMemo(() => (checkoutQuestion.placeholder ? formatMessage({ id: checkoutQuestion.placeholder }) : ""), [formatMessage, checkoutQuestion.placeholder]);
|
|
10
|
+
const placeholderText = useMemo(() => (checkoutQuestion.metadata.placeholder ? formatMessage({ id: checkoutQuestion.metadata.placeholder }) : ""), [formatMessage, checkoutQuestion.metadata.placeholder]);
|
|
10
11
|
const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
|
|
11
12
|
const handleOnChange = useCallback((value) => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: value }), [onChange, checkoutQuestionParentId]);
|
|
12
13
|
const style = useMemo(() => textareaCheckoutQuestionItemStyle(), []);
|