@lookiero/checkout 9.9.0-beta.2 → 9.10.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/fake-dependencies/@lookiero/payments-front/index.d.ts +6 -8
- package/dist/fake-dependencies/@lookiero/payments-front/index.js +4 -7
- package/dist/index.js +2 -2
- package/dist/src/ExpoRoot.js +13 -17
- package/dist/src/infrastructure/ui/Root.d.ts +2 -0
- package/dist/src/infrastructure/ui/Root.js +4 -2
- package/dist/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.js +3 -2
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +1 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.d.ts +0 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.js +0 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +1 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.d.ts +0 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.js +0 -1
- package/dist/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.d.ts +2 -3
- package/dist/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.js +26 -17
- package/dist/src/infrastructure/ui/hooks/useQueryBus.d.ts +9 -0
- package/dist/src/infrastructure/ui/hooks/useQueryBus.js +10 -0
- package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.d.ts +1 -1
- package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +55 -22
- package/dist/src/infrastructure/ui/i18n/i18n.d.ts +0 -1
- package/dist/src/infrastructure/ui/i18n/i18n.js +0 -1
- package/dist/src/infrastructure/ui/views/App.js +6 -5
- package/dist/src/infrastructure/ui/views/checkout/Checkout.js +2 -5
- package/dist/src/infrastructure/ui/views/checkout/Checkout.style.d.ts +0 -3
- package/dist/src/infrastructure/ui/views/checkout/Checkout.style.js +0 -3
- package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +2 -2
- package/dist/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js +7 -7
- package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.d.ts +1 -0
- package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.js +2 -1
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +1 -0
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.js +2 -1
- package/dist/src/projection/customer/customer.d.ts +0 -2
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/fake-dependencies/@lookiero/payments-front/index.tsx +9 -32
- package/index.ts +2 -2
- package/jest.config.js +2 -2
- package/package.json +7 -7
- package/src/ExpoRoot.tsx +32 -37
- package/src/infrastructure/ui/Root.tsx +30 -17
- package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.ts +3 -2
- package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/__snapshots__/FiveItemsDiscountBanner.test.tsx.snap +1 -1
- package/src/infrastructure/ui/components/atoms/price/__snapshots__/Price.test.tsx.snap +3 -3
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.ts +0 -1
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.tsx +1 -0
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.ts +0 -1
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +1 -0
- package/src/infrastructure/ui/components/templates/header/checkoutHeader/__snapshots__/CheckoutHeader.test.tsx.snap +1 -1
- package/src/infrastructure/ui/components/templates/header/itemDetailHeader/__snapshots__/ItemDetailHeader.test.tsx.snap +1 -1
- package/src/infrastructure/ui/components/templates/header/itemHeader/__snapshots__/ItemHeader.test.tsx.snap +1 -1
- package/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.ts +60 -18
- package/src/infrastructure/ui/hooks/useQueryBus.test.tsx +23 -0
- package/src/infrastructure/ui/hooks/useQueryBus.tsx +27 -0
- package/src/infrastructure/ui/hooks/useSubmitCheckout.test.ts +58 -0
- package/src/infrastructure/ui/hooks/useSubmitCheckout.ts +77 -33
- package/src/infrastructure/ui/i18n/i18n.ts +0 -1
- package/src/infrastructure/ui/views/App.tsx +13 -5
- package/src/infrastructure/ui/views/checkout/Checkout.style.ts +0 -3
- package/src/infrastructure/ui/views/checkout/Checkout.tsx +3 -12
- package/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.tsx +2 -2
- package/src/infrastructure/ui/views/checkout/components/deliveryBanner/__snapshots__/DeliveryBanner.test.tsx.snap +1 -1
- package/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.tsx +8 -8
- package/src/infrastructure/ui/views/item/components/banner/__snapshots__/CustomerDecissionBanner.test.tsx.snap +3 -3
- package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/__snapshots__/GetOutOfCheckoutModal.test.tsx.snap +3 -3
- package/src/infrastructure/ui/views/item/components/itemActions/__snapshots__/ItemActions.test.tsx.snap +5 -5
- package/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.ts +2 -1
- package/src/infrastructure/ui/views/item/components/productVariantDescription/__snapshots__/ProductVariantDescription.test.tsx.snap +10 -8
- package/src/infrastructure/ui/views/item/components/productVariantSlider/__snapshots__/ProductVariantSlider.test.tsx.snap +30 -30
- package/src/infrastructure/ui/views/item/components/selectModal/__snapshots__/SelecModal.test.tsx.snap +1 -1
- package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/__snapshots__/SizeWithoutStockModal.test.tsx.snap +2 -2
- package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +105 -102
- package/src/infrastructure/ui/views/return/components/price/__snapshots__/Price.test.tsx.snap +3 -3
- package/src/infrastructure/ui/views/return/components/productVariantPreview/__snapshots__/ProductVariantPreview.test.tsx.snap +1 -1
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.ts +2 -1
- package/src/infrastructure/ui/views/shared/components/productVariant/__snapshots__/ProductVariant.test.tsx.snap +30 -30
- package/src/infrastructure/ui/views/summary/components/collapsiblePricing/__snapshots__/CollapsiblePricing.test.tsx.snap +4 -4
- package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/__snapshots__/CheckoutItemsTabs.test.tsx.snap +62 -62
- package/src/projection/customer/customer.ts +0 -2
- package/dist/pact.config.d.ts +0 -21
- package/dist/pact.config.js +0 -16
- 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/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +0 -55
- package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +0 -116
- package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +0 -56
- package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +0 -51
- package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +0 -51
- package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +0 -51
- package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +0 -13
- package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +0 -19
- package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +0 -56
- package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +0 -57
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +0 -55
- package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +0 -120
- package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +0 -55
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +0 -55
- package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +0 -22
- package/dist/src/infrastructure/ui/components/layouts/layout/Layout.js +0 -1
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +0 -7
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +0 -5
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +0 -7
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +0 -6
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +0 -4
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +0 -20
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +0 -4
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +0 -43
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +0 -12
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +0 -14
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +0 -7
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +0 -21
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +0 -8
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +0 -12
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +0 -12
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +0 -64
- package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +0 -10
- package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +0 -17
- package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +0 -20
- package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +0 -27
- package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +0 -10
- package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +0 -27
- package/dist/src/infrastructure/ui/views/App.style.d.ts +0 -6
- package/dist/src/infrastructure/ui/views/App.style.js +0 -8
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +0 -7
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +0 -11
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +0 -12
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +0 -64
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +0 -12
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +0 -16
- package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +0 -40
- package/dist/src/infrastructure/ui/views/return/Return.style.js +0 -44
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +0 -14
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +0 -28
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +0 -7
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +0 -11
- package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +0 -26
- package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +0 -21
- package/dist/src/projection/shared/country.d.ts +0 -14
- package/dist/src/projection/shared/country.js +0 -15
- package/dist/src/projection/shared/customer.d.ts +0 -9
- package/dist/src/projection/shared/customer.js +0 -1
- package/dist/src/projection/shared/locale.d.ts +0 -12
- package/dist/src/projection/shared/locale.js +0 -13
- package/dist/src/projection/shared/order.d.ts +0 -6
- package/dist/src/projection/shared/order.js +0 -1
- package/dist/src/projection/shared/price.d.ts +0 -11
- package/dist/src/projection/shared/price.js +0 -1
- package/dist/src/projection/shared/size.d.ts +0 -21
- package/dist/src/projection/shared/size.js +0 -4
- package/dist/src/projection/shared/subscription.d.ts +0 -2
- package/dist/src/projection/shared/subscription.js +0 -1
- package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.d.ts +0 -15
- package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.js +0 -16
- package/dist/src/shared/ui/components/atoms/error/Error.d.ts +0 -11
- package/dist/src/shared/ui/components/atoms/error/Error.js +0 -6
- package/dist/src/shared/ui/components/atoms/field/Field.d.ts +0 -14
- package/dist/src/shared/ui/components/atoms/field/Field.js +0 -29
- package/dist/src/shared/ui/components/atoms/field/Field.style.d.ts +0 -16
- package/dist/src/shared/ui/components/atoms/field/Field.style.js +0 -19
- package/dist/src/shared/ui/components/molecules/inputField/InputField.d.ts +0 -24
- package/dist/src/shared/ui/components/molecules/inputField/InputField.js +0 -28
- package/dist/src/shared/ui/components/molecules/inputField/InputField.style.d.ts +0 -29
- package/dist/src/shared/ui/components/molecules/inputField/InputField.style.js +0 -37
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "@lookiero/sty-psp-ui";
|
|
3
3
|
import { HEADER_HEIGHT } from "../../../../components/templates/header/Header.style";
|
|
4
|
-
const { borderRadius5, colorBgPrimaryLight, colorBgBase, colorTextMedium, space4, space6, space8 } = theme();
|
|
4
|
+
const { borderRadius5, colorBgPrimaryLight, colorBgBase, colorTextMedium, space1, space4, space6, space8 } = theme();
|
|
5
5
|
const style = StyleSheet.create({
|
|
6
6
|
background: {
|
|
7
7
|
backgroundColor: colorBgPrimaryLight,
|
|
@@ -25,6 +25,7 @@ const style = StyleSheet.create({
|
|
|
25
25
|
},
|
|
26
26
|
info: {
|
|
27
27
|
backgroundColor: colorBgBase,
|
|
28
|
+
gap: space1,
|
|
28
29
|
paddingBottom: space4,
|
|
29
30
|
paddingHorizontal: space6,
|
|
30
31
|
paddingTop: space8,
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "9.
|
|
1
|
+
export declare const VERSION = "9.10.0";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "9.
|
|
1
|
+
export const VERSION = "9.10.0";
|
|
@@ -7,57 +7,34 @@ import {
|
|
|
7
7
|
RefAttributes,
|
|
8
8
|
useImperativeHandle,
|
|
9
9
|
} from "react";
|
|
10
|
-
import { PaymentPayload } from "@lookiero/payments-front";
|
|
11
10
|
|
|
12
11
|
const setPaymentsBridge = () => void 0;
|
|
13
12
|
const PaymentsQueryProvider: FC<PropsWithChildren> = ({ children }) => children;
|
|
14
13
|
const PaymentInstrumentSelect: FC = () => null;
|
|
15
|
-
|
|
14
|
+
interface StartLegacyBoxCheckoutCallbackArgs {
|
|
15
|
+
readonly status: string;
|
|
16
|
+
readonly final: boolean;
|
|
17
|
+
}
|
|
16
18
|
interface StartLegacyBoxCheckoutFunction {
|
|
17
|
-
(paymentFlowPayload: unknown): void;
|
|
19
|
+
(paymentFlowPayload: unknown, callback: (params: StartLegacyBoxCheckoutCallbackArgs) => Promise<void>): void;
|
|
18
20
|
}
|
|
19
|
-
|
|
20
21
|
interface PaymentFlowRef {
|
|
21
22
|
readonly startLegacyBoxCheckout: StartLegacyBoxCheckoutFunction;
|
|
22
23
|
}
|
|
23
|
-
|
|
24
24
|
const paymentFlowRef: PaymentFlowRef = {
|
|
25
|
-
startLegacyBoxCheckout: async () => {
|
|
25
|
+
startLegacyBoxCheckout: async (_paymentFlowPayload, callback) => {
|
|
26
|
+
await callback({ status: "EXECUTED", final: true });
|
|
27
|
+
},
|
|
26
28
|
};
|
|
27
|
-
|
|
28
29
|
const PaymentFlow: ForwardRefExoticComponent<RefAttributes<PaymentFlowRef>> = forwardRef<PaymentFlowRef, unknown>(
|
|
29
30
|
(_props, ref) => {
|
|
30
31
|
useImperativeHandle(ref, () => paymentFlowRef, []);
|
|
31
32
|
return null;
|
|
32
33
|
},
|
|
33
34
|
);
|
|
34
|
-
|
|
35
35
|
PaymentFlow.displayName = "PaymentFlow";
|
|
36
|
-
|
|
37
|
-
interface UsePaymentStatusManagerResult {
|
|
38
|
-
isLoading: boolean;
|
|
39
|
-
consumePayload: (callback: (payload: PaymentPayload) => void) => void;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const paymentStatusManagerResult: UsePaymentStatusManagerResult = {
|
|
43
|
-
isLoading: false,
|
|
44
|
-
consumePayload: (callback) => callback({ success: true } as PaymentPayload),
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const usePaymentStatusManager: (section: Section) => UsePaymentStatusManagerResult = () => paymentStatusManagerResult;
|
|
48
|
-
|
|
49
36
|
enum Section {
|
|
50
37
|
BOX_CHECKOUT = "box-checkout",
|
|
51
38
|
}
|
|
52
|
-
|
|
53
39
|
export type { PaymentFlowRef };
|
|
54
|
-
|
|
55
|
-
export {
|
|
56
|
-
PaymentsQueryProvider,
|
|
57
|
-
PaymentInstrumentSelect,
|
|
58
|
-
PaymentFlow,
|
|
59
|
-
Section,
|
|
60
|
-
setPaymentsBridge,
|
|
61
|
-
paymentFlowRef,
|
|
62
|
-
usePaymentStatusManager,
|
|
63
|
-
};
|
|
40
|
+
export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, paymentFlowRef };
|
package/index.ts
CHANGED
|
@@ -44,14 +44,14 @@ const bootstrap: BootstrapFunction = ({ apiUrl, getAuthToken, translations, sent
|
|
|
44
44
|
const { Component: Messaging, queryBus } = checkoutBootstrap({ apiUrl, getAuthToken });
|
|
45
45
|
const I18n = i18n({
|
|
46
46
|
fetchTranslation: fetchTranslations({ translations }),
|
|
47
|
-
|
|
47
|
+
domain: "CheckoutI18n",
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
const firstAvailableCheckoutByCustomerId: FirstAvailableCheckoutByCustomerIdFunction = ({ customerId }) =>
|
|
51
51
|
queryBus(viewFirstAvailableCheckoutByCustomerId({ customerId: customerId as string }));
|
|
52
52
|
|
|
53
53
|
return {
|
|
54
|
-
root: root({ Messaging, I18n, getAuthToken, sentry, kameleoon }),
|
|
54
|
+
root: root({ Messaging, I18n, queryBus, getAuthToken, sentry, kameleoon }),
|
|
55
55
|
firstAvailableCheckoutByCustomerId,
|
|
56
56
|
};
|
|
57
57
|
};
|
package/jest.config.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const jestReactNativeConfig = require("@lookiero/sty-psp-jest-config/jest.config.
|
|
1
|
+
const jestReactNativeConfig = require("@lookiero/sty-psp-jest-config/jest.config.expo.js");
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
...jestReactNativeConfig,
|
|
5
|
-
setupFiles: ["../../node_modules/react-native-gesture-handler/jestSetup.js"],
|
|
6
5
|
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
|
|
6
|
+
setupFiles: ["../../node_modules/react-native-gesture-handler/jestSetup.js"],
|
|
7
7
|
moduleNameMapper: {
|
|
8
8
|
...(jestReactNativeConfig.moduleNameMapper || {}),
|
|
9
9
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.10.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"sideEffects": "false",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"@lookiero/sty-psp-ab-testing": "^0.3",
|
|
25
25
|
"@lookiero/sty-psp-expo-config": "^0.2",
|
|
26
26
|
"@lookiero/sty-psp-http": "^2.0",
|
|
27
|
-
"@lookiero/sty-psp-i18n": "^0.
|
|
27
|
+
"@lookiero/sty-psp-i18n": "^0.3",
|
|
28
28
|
"@lookiero/sty-psp-locale": "^0.4",
|
|
29
29
|
"@lookiero/sty-psp-logging": "^0.5",
|
|
30
|
-
"@lookiero/sty-psp-notifications": "^0.
|
|
30
|
+
"@lookiero/sty-psp-notifications": "^0.7",
|
|
31
31
|
"@lookiero/sty-psp-react-native": "^0.3",
|
|
32
32
|
"@lookiero/sty-psp-segment": "^0.1",
|
|
33
33
|
"@lookiero/sty-psp-storage": "^0.2",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@cypress/webpack-preprocessor": "^6.0.2",
|
|
47
47
|
"@lookiero/eslint-config-sty-psp": "*",
|
|
48
48
|
"@lookiero/event": "^0.3",
|
|
49
|
-
"@lookiero/payments-front": "
|
|
49
|
+
"@lookiero/payments-front": "6.0.3",
|
|
50
50
|
"@lookiero/sty-psp-jest-config": "*",
|
|
51
51
|
"@lookiero/sty-psp-prettier-config": "*",
|
|
52
52
|
"@lookiero/sty-psp-scripts": "*",
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
"@lookiero/aurora-fonts": ">=2",
|
|
75
75
|
"@lookiero/aurora-iconfont": ">=3",
|
|
76
76
|
"@lookiero/event": "^0.3",
|
|
77
|
-
"@lookiero/i18n": ">=
|
|
78
|
-
"@lookiero/i18n-react": ">=
|
|
79
|
-
"@lookiero/payments-front": "
|
|
77
|
+
"@lookiero/i18n": ">=1",
|
|
78
|
+
"@lookiero/i18n-react": ">=1",
|
|
79
|
+
"@lookiero/payments-front": "6.0.3",
|
|
80
80
|
"apollo-boost": "0.4.4",
|
|
81
81
|
"expo": ">=51",
|
|
82
82
|
"expo-font": ">=12",
|
package/src/ExpoRoot.tsx
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PortalProvider } from "@gorhom/portal";
|
|
2
1
|
import { useFonts } from "expo-font";
|
|
3
2
|
import "expo/build/Expo.fx";
|
|
4
3
|
import React, { FC, useCallback, useState } from "react";
|
|
@@ -33,11 +32,9 @@ const order: Order = {
|
|
|
33
32
|
};
|
|
34
33
|
|
|
35
34
|
const customer: Customer = {
|
|
36
|
-
customerId: "
|
|
35
|
+
customerId: "74cb4f76-3f14-4983-81a6-2ee2a9a275d4",
|
|
37
36
|
country: Country.ES,
|
|
38
37
|
segment: Segment.WOMEN,
|
|
39
|
-
email: "email@example.com",
|
|
40
|
-
name: "Adèle Léonce Émilie",
|
|
41
38
|
};
|
|
42
39
|
|
|
43
40
|
const sentryConfig: SentryEnvironment = {
|
|
@@ -54,7 +51,7 @@ const apiUrl =
|
|
|
54
51
|
? "/local-to-dev"
|
|
55
52
|
: "/checkout/api";
|
|
56
53
|
const authToken =
|
|
57
|
-
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.
|
|
54
|
+
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU2NDg3OTAsImV4cCI6MTc0NDQ0MzcwMiwiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjQtMTEtMDgiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiNzRjYjRmNzYtM2YxNC00OTgzLTgxYTYtMmVlMmE5YTI3NWQ0IiwiaWF0IjoxNzQxNzY1MzAyfQ.VrfjWZlhuG8dhDSFTbyGyClRFGbhdx9SglkE8rEEJyE";
|
|
58
55
|
const getAuthToken = () => Promise.resolve(authToken);
|
|
59
56
|
|
|
60
57
|
const externalTranslationsUrl =
|
|
@@ -95,7 +92,6 @@ setPaymentsBridge({
|
|
|
95
92
|
useFeatureFlags: () => ({}),
|
|
96
93
|
locale: () => Promise.resolve("es-ES"),
|
|
97
94
|
scrollView: ScrollView,
|
|
98
|
-
hostUrl: "",
|
|
99
95
|
});
|
|
100
96
|
|
|
101
97
|
const kameleoonConfig: KameleoonEnvironment = {
|
|
@@ -103,17 +99,18 @@ const kameleoonConfig: KameleoonEnvironment = {
|
|
|
103
99
|
experiments: {},
|
|
104
100
|
};
|
|
105
101
|
|
|
106
|
-
const { Component: Messaging } =
|
|
102
|
+
const { Component: Messaging, queryBus } =
|
|
107
103
|
process.env.EXPO_PUBLIC_APP_VARIANT === "test"
|
|
108
104
|
? checkoutMockBootstrap()
|
|
109
105
|
: checkoutBootstrap({ apiUrl: () => apiUrl, getAuthToken });
|
|
110
106
|
const I18n = i18n({
|
|
111
107
|
fetchTranslation: fetchTranslations({ translations }),
|
|
112
|
-
|
|
108
|
+
domain: "CheckoutI18n",
|
|
113
109
|
});
|
|
114
110
|
const Root = root({
|
|
115
111
|
Messaging,
|
|
116
112
|
I18n,
|
|
113
|
+
queryBus,
|
|
117
114
|
getAuthToken,
|
|
118
115
|
development: false,
|
|
119
116
|
sentry: () => (process.env.EXPO_PUBLIC_APP_VARIANT === "test" ? ({} as SentryEnvironment) : sentryConfig),
|
|
@@ -132,37 +129,35 @@ const ExpoRoot: FC = () => {
|
|
|
132
129
|
const onNotAccessible = useCallback(() => setIsAccessible(false), []);
|
|
133
130
|
|
|
134
131
|
return fontsLoaded ? (
|
|
135
|
-
<
|
|
136
|
-
<
|
|
137
|
-
<
|
|
138
|
-
<
|
|
139
|
-
{isAccessible === false && <Text heading={true}>Checkout is not accessible!</Text>}
|
|
132
|
+
<PaymentsQueryProvider>
|
|
133
|
+
<EventProvider>
|
|
134
|
+
<Aurora>
|
|
135
|
+
{isAccessible === false && <Text heading={true}>Checkout is not accessible!</Text>}
|
|
140
136
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
137
|
+
<Router>
|
|
138
|
+
<Routes>
|
|
139
|
+
<Route
|
|
140
|
+
path="/checkout/*"
|
|
141
|
+
element={
|
|
142
|
+
<Root
|
|
143
|
+
basePath="/checkout"
|
|
144
|
+
customer={customer}
|
|
145
|
+
layout={DummyLayout}
|
|
146
|
+
locale={locale}
|
|
147
|
+
order={order}
|
|
148
|
+
subscription={subscription}
|
|
149
|
+
useRedirect={useRedirect}
|
|
150
|
+
onNotAccessible={onNotAccessible}
|
|
151
|
+
/>
|
|
152
|
+
}
|
|
153
|
+
/>
|
|
158
154
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
</PortalProvider>
|
|
155
|
+
<Route element={<Navigate to="/checkout" replace />} path="*" />
|
|
156
|
+
</Routes>
|
|
157
|
+
</Router>
|
|
158
|
+
</Aurora>
|
|
159
|
+
</EventProvider>
|
|
160
|
+
</PaymentsQueryProvider>
|
|
166
161
|
) : null;
|
|
167
162
|
};
|
|
168
163
|
|
|
@@ -3,6 +3,7 @@ import React, { ComponentType, useCallback } from "react";
|
|
|
3
3
|
import { Platform } from "react-native";
|
|
4
4
|
import { useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
5
5
|
import { I18n } from "@lookiero/i18n-react";
|
|
6
|
+
import { QueryBus } from "@lookiero/messaging";
|
|
6
7
|
import { MessagingRoot } from "@lookiero/messaging-react/bootstrap";
|
|
7
8
|
import { Locale } from "@lookiero/sty-psp-locale";
|
|
8
9
|
import { SentryEnvironment, SentryLoggerFunctionArgs, sentryLogger, sentryLoggerHOC } from "@lookiero/sty-psp-logging";
|
|
@@ -11,11 +12,13 @@ import { Customer } from "../../projection/customer/customer";
|
|
|
11
12
|
import { Order } from "../../projection/order/order";
|
|
12
13
|
import { Subscription } from "../../projection/subscription/subscription";
|
|
13
14
|
import { KameleoonEnvironment } from "../ab-testing/kameleoonEnvironment";
|
|
15
|
+
import { QueryBusProvider } from "./hooks/useQueryBus";
|
|
14
16
|
import { Routing } from "./routing/Routing";
|
|
15
17
|
|
|
16
18
|
interface RootFunctionArgs {
|
|
17
19
|
readonly Messaging: MessagingRoot;
|
|
18
20
|
readonly I18n: I18n;
|
|
21
|
+
readonly queryBus: QueryBus;
|
|
19
22
|
readonly development?: boolean;
|
|
20
23
|
readonly sentry: () => SentryEnvironment;
|
|
21
24
|
readonly getAuthToken: () => Promise<string>;
|
|
@@ -39,7 +42,15 @@ interface RootProps {
|
|
|
39
42
|
readonly useRoutes?: typeof reactRouterUseRoutes;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
const root: RootFunction = ({
|
|
45
|
+
const root: RootFunction = ({
|
|
46
|
+
Messaging,
|
|
47
|
+
I18n,
|
|
48
|
+
queryBus,
|
|
49
|
+
getAuthToken,
|
|
50
|
+
development,
|
|
51
|
+
sentry,
|
|
52
|
+
kameleoon: kameleoonConfig,
|
|
53
|
+
}) => {
|
|
43
54
|
const logger = sentryLogger(sentry);
|
|
44
55
|
const kameleoon = kameleoonConfig();
|
|
45
56
|
|
|
@@ -60,22 +71,24 @@ const root: RootFunction = ({ Messaging, I18n, getAuthToken, development, sentry
|
|
|
60
71
|
|
|
61
72
|
return (
|
|
62
73
|
<Messaging includeReactQueryDevTools={Platform.OS === "web"}>
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
<QueryBusProvider queryBus={queryBus}>
|
|
75
|
+
<Routing
|
|
76
|
+
I18n={I18n}
|
|
77
|
+
basePath={basePath}
|
|
78
|
+
customer={customer}
|
|
79
|
+
getAuthToken={getAuthToken}
|
|
80
|
+
kameleoon={kameleoon}
|
|
81
|
+
layout={layout}
|
|
82
|
+
locale={locale}
|
|
83
|
+
order={order}
|
|
84
|
+
subscription={subscription}
|
|
85
|
+
useRedirect={useRedirect}
|
|
86
|
+
useRoutes={useRoutes}
|
|
87
|
+
onCheckoutSubmitted={onCheckoutSubmitted}
|
|
88
|
+
onI18nError={development ? undefined : handleOnI18nError}
|
|
89
|
+
onNotAccessible={onNotAccessible}
|
|
90
|
+
/>
|
|
91
|
+
</QueryBusProvider>
|
|
79
92
|
</Messaging>
|
|
80
93
|
);
|
|
81
94
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "@lookiero/sty-psp-ui";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
const { fontMap } = theme();
|
|
4
5
|
|
|
5
6
|
const style = StyleSheet.create({
|
|
6
7
|
textBold: {
|
|
7
|
-
fontFamily:
|
|
8
|
+
fontFamily: fontMap.Action,
|
|
8
9
|
},
|
|
9
10
|
});
|
|
10
11
|
|
|
@@ -51,7 +51,7 @@ exports[`Price atom matches the snapshot for a discounted price: discounted pric
|
|
|
51
51
|
"paddingBottom": 0,
|
|
52
52
|
"paddingLeft": 0,
|
|
53
53
|
"paddingRight": 0,
|
|
54
|
-
"paddingTop":
|
|
54
|
+
"paddingTop": 0,
|
|
55
55
|
},
|
|
56
56
|
]
|
|
57
57
|
}
|
|
@@ -81,7 +81,7 @@ exports[`Price atom matches the snapshot for a discounted price: discounted pric
|
|
|
81
81
|
"paddingBottom": 0,
|
|
82
82
|
"paddingLeft": 0,
|
|
83
83
|
"paddingRight": 0,
|
|
84
|
-
"paddingTop":
|
|
84
|
+
"paddingTop": 0,
|
|
85
85
|
"textDecorationLine": "line-through",
|
|
86
86
|
},
|
|
87
87
|
]
|
|
@@ -146,7 +146,7 @@ exports[`Price atom matches the snapshot for a non-discounted price: non-discoun
|
|
|
146
146
|
"paddingBottom": 0,
|
|
147
147
|
"paddingLeft": 0,
|
|
148
148
|
"paddingRight": 0,
|
|
149
|
-
"paddingTop":
|
|
149
|
+
"paddingTop": 0,
|
|
150
150
|
},
|
|
151
151
|
]
|
|
152
152
|
}
|
|
@@ -1,33 +1,75 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import {
|
|
1
|
+
import { useCallback, useEffect } from "react";
|
|
2
|
+
import { useEvent } from "@lookiero/event";
|
|
3
|
+
import { Logger } from "@lookiero/sty-psp-logging";
|
|
4
|
+
import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
|
|
5
|
+
import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
|
|
6
|
+
import { I18nMessages } from "../i18n/i18n";
|
|
7
|
+
|
|
8
|
+
const PAYMENT_ERROR = "ERROR";
|
|
9
|
+
const PAYMENT_SUCCESS = "PAYMENT_INSTRUMENT_UPDATED";
|
|
10
|
+
|
|
11
|
+
interface Message {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
}
|
|
14
|
+
interface OnSuccessFunctionArgs {
|
|
15
|
+
readonly message: Message;
|
|
16
|
+
}
|
|
17
|
+
interface OnSuccessFunction {
|
|
18
|
+
(args: OnSuccessFunctionArgs): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface Toaster {
|
|
22
|
+
readonly id: string;
|
|
23
|
+
}
|
|
24
|
+
interface Error {
|
|
25
|
+
readonly toaster?: Toaster;
|
|
26
|
+
}
|
|
27
|
+
interface OnErrorFunctionArgs {
|
|
28
|
+
readonly error: Error;
|
|
29
|
+
}
|
|
30
|
+
interface OnErrorFunction {
|
|
31
|
+
(args: OnErrorFunctionArgs): void;
|
|
32
|
+
}
|
|
3
33
|
|
|
4
34
|
interface UsePaymentInstrumentEventsFunctionArgs {
|
|
5
|
-
readonly
|
|
6
|
-
readonly onError: (payload: PaymentPayload) => void;
|
|
35
|
+
readonly logger: Logger;
|
|
7
36
|
}
|
|
8
37
|
|
|
9
38
|
interface UsePaymentInstrumentEventsFunction {
|
|
10
39
|
(args: UsePaymentInstrumentEventsFunctionArgs): void;
|
|
11
40
|
}
|
|
12
41
|
|
|
13
|
-
const usePaymentInstrumentEvents: UsePaymentInstrumentEventsFunction = ({
|
|
14
|
-
const
|
|
42
|
+
const usePaymentInstrumentEvents: UsePaymentInstrumentEventsFunction = ({ logger }) => {
|
|
43
|
+
const { subscribe, unsubscribe } = useEvent();
|
|
15
44
|
|
|
16
|
-
|
|
17
|
-
const { isLoading, consumePayload } = refreshStatus;
|
|
45
|
+
const [createNotification] = useCreateToastNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
|
|
18
46
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
47
|
+
const onSuccess: OnSuccessFunction = useCallback(
|
|
48
|
+
({ message }) => createNotification({ bodyI18nKey: message.id, level: NotificationLevel.SUCCESS }),
|
|
49
|
+
[createNotification],
|
|
50
|
+
);
|
|
22
51
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
52
|
+
const onError: OnErrorFunction = useCallback(
|
|
53
|
+
({ error }) => {
|
|
54
|
+
if (error.toaster) {
|
|
55
|
+
createNotification({
|
|
56
|
+
bodyI18nKey: error.toaster.id || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
|
|
57
|
+
level: NotificationLevel.ERROR,
|
|
58
|
+
});
|
|
28
59
|
}
|
|
29
|
-
}
|
|
30
|
-
|
|
60
|
+
},
|
|
61
|
+
[createNotification],
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
subscribe({ event: PAYMENT_ERROR }, onError);
|
|
66
|
+
subscribe({ event: PAYMENT_SUCCESS }, onSuccess);
|
|
67
|
+
|
|
68
|
+
return () => {
|
|
69
|
+
unsubscribe({ event: PAYMENT_ERROR }, onError);
|
|
70
|
+
unsubscribe({ event: PAYMENT_SUCCESS }, onSuccess);
|
|
71
|
+
};
|
|
72
|
+
}, [subscribe, unsubscribe, createNotification, onError, onSuccess]);
|
|
31
73
|
};
|
|
32
74
|
|
|
33
75
|
export { usePaymentInstrumentEvents };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { renderHook, waitFor } from "@testing-library/react-native";
|
|
2
|
+
import { mockFn } from "jest-mock-extended";
|
|
3
|
+
import React, { FC } from "react";
|
|
4
|
+
import { QueryBus } from "@lookiero/messaging";
|
|
5
|
+
import { QueryBusProvider, useQueryBus as sut } from "./useQueryBus";
|
|
6
|
+
|
|
7
|
+
const mockQueryBus = mockFn<QueryBus>();
|
|
8
|
+
|
|
9
|
+
interface WrapperProps {
|
|
10
|
+
readonly children: JSX.Element;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const Wrapper: FC<WrapperProps> = ({ children }) => (
|
|
14
|
+
<QueryBusProvider queryBus={mockQueryBus}>{children}</QueryBusProvider>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
describe("useQueryBus hook", () => {
|
|
18
|
+
it("returns the QueryBusProvider provided queryBus", async () => {
|
|
19
|
+
const { result } = renderHook(() => sut(), { wrapper: Wrapper });
|
|
20
|
+
|
|
21
|
+
await waitFor(() => expect(result.current).toEqual(mockQueryBus));
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { createContext, FC, ReactNode, useContext } from "react";
|
|
2
|
+
import invariant from "tiny-invariant";
|
|
3
|
+
import { QueryBus } from "@lookiero/messaging";
|
|
4
|
+
|
|
5
|
+
const QueryBusContext = createContext<QueryBus>(null as unknown as QueryBus);
|
|
6
|
+
|
|
7
|
+
interface QueryBusProviderProps {
|
|
8
|
+
readonly children: ReactNode;
|
|
9
|
+
readonly queryBus: QueryBus;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const QueryBusProvider: FC<QueryBusProviderProps> = ({ children, queryBus }) => (
|
|
13
|
+
<QueryBusContext.Provider value={queryBus}>{children}</QueryBusContext.Provider>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
const useQueryBus = () => {
|
|
17
|
+
const queryBus = useContext(QueryBusContext);
|
|
18
|
+
|
|
19
|
+
invariant(
|
|
20
|
+
queryBus,
|
|
21
|
+
"Your are trying to use the useQueryBus hook without wrapping your app with the <QueryBusProvider>.",
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return queryBus;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { useQueryBus, QueryBusProvider };
|