@lookiero/checkout 0.1.1 → 0.2.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/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.d.ts +4 -4
- package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.js +3 -2
- package/dist/domain/checkoutBooking/model/checkoutBooking.d.ts +3 -2
- package/dist/domain/checkoutBooking/model/checkoutBooking.js +2 -1
- package/dist/domain/checkoutBooking/model/checkoutBookingBooked.d.ts +4 -4
- package/dist/domain/checkoutBooking/model/checkoutBookingBooked.js +3 -2
- package/dist/domain/checkoutBooking/model/checkoutBookings.d.ts +3 -2
- package/dist/domain/uiSetting/command/updateUiSetting.d.ts +4 -4
- package/dist/domain/uiSetting/command/updateUiSetting.js +3 -2
- package/dist/domain/uiSetting/model/uiSetting.d.ts +3 -2
- package/dist/domain/uiSetting/model/uiSetting.js +2 -1
- package/dist/domain/uiSetting/model/uiSettingUpdated.d.ts +4 -4
- package/dist/domain/uiSetting/model/uiSettingUpdated.js +3 -2
- package/dist/domain/uiSetting/model/uiSettings.d.ts +3 -2
- package/dist/infrastructure/delivery/_mock/bootstrap.mock.js +2 -1
- package/dist/infrastructure/delivery/bootstrap.d.ts +2 -1
- package/dist/infrastructure/delivery/bootstrap.js +3 -2
- package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.d.ts +2 -2
- package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.js +2 -1
- package/dist/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.d.ts +2 -2
- package/dist/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.js +2 -1
- package/dist/infrastructure/domain/react/useSetCheckoutIntroShown.d.ts +13 -0
- package/dist/infrastructure/domain/react/useSetCheckoutIntroShown.js +9 -0
- package/dist/infrastructure/domain/react/useUpdateUiSetting.d.ts +2 -2
- package/dist/infrastructure/domain/react/useUpdateUiSetting.js +2 -1
- package/dist/infrastructure/domain/uiSetting/model/storageUiSettings.d.ts +3 -3
- package/dist/infrastructure/domain/uiSetting/model/storageUiSettings.js +3 -2
- package/dist/infrastructure/persistence/asyncStorageStorage.d.ts +3 -2
- package/dist/infrastructure/persistence/asyncStorageStorage.js +3 -2
- package/dist/infrastructure/persistence/storage.d.ts +3 -2
- package/dist/infrastructure/persistence/uiSettingData.d.ts +2 -1
- package/dist/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.js +2 -1
- package/dist/infrastructure/projection/react/useViewCheckoutIntroShown.d.ts +2 -0
- package/dist/infrastructure/projection/react/useViewCheckoutIntroShown.js +6 -0
- package/dist/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.js +2 -1
- package/dist/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.js +2 -1
- package/dist/infrastructure/projection/react/useViewUiSettingByKey.d.ts +3 -3
- package/dist/infrastructure/projection/react/useViewUiSettingByKey.js +9 -5
- package/dist/infrastructure/projection/storageUiSettingByKeyView.d.ts +2 -2
- package/dist/infrastructure/projection/storageUiSettingByKeyView.js +2 -1
- package/dist/infrastructure/ui/Root.js +8 -10
- package/dist/infrastructure/ui/components/atoms/spinner/Spinner.js +9 -0
- package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +4 -4
- package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +13 -10
- package/dist/infrastructure/ui/routing/Routing.js +11 -14
- package/dist/infrastructure/ui/settings/UISettings.d.ts +4 -0
- package/dist/infrastructure/ui/settings/UISettings.js +5 -0
- package/dist/infrastructure/ui/views/intro/Intro.js +5 -7
- package/dist/infrastructure/ui/views/item/Item.js +6 -8
- package/dist/infrastructure/ui/views/summary/Summary.js +5 -7
- package/dist/projection/uiSetting/viewUiSettingByKey.d.ts +6 -6
- package/dist/projection/uiSetting/viewUiSettingByKey.js +4 -3
- package/package.json +6 -3
- package/.eslintignore +0 -7
- package/.eslintrc +0 -72
- package/.expo-shared/assets.json +0 -4
- package/.github/CODEOWNERS +0 -1
- package/.github/actions/version/action.yaml +0 -32
- package/.github/dependabot.yaml +0 -10
- package/.github/workflows/build.yaml +0 -71
- package/.github/workflows/publish.yaml +0 -52
- package/.husky/pre-commit +0 -4
- package/.husky/prepare-commit-msg +0 -26
- package/.husky/prepush +0 -12
- package/.lintstagedrc.json +0 -4
- package/.nvmrc +0 -1
- package/.prettierignore +0 -2
- package/.prettierrc.json +0 -6
- package/@types/aurora-next.d.ts +0 -1
- package/app.config.js +0 -4
- package/app.json +0 -31
- package/assets/adaptive-icon.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/icon.png +0 -0
- package/assets/splash.png +0 -0
- package/babel.config.js +0 -6
- package/dist/infrastructure/projection/react/useViewIsCheckoutIntroVisible.d.ts +0 -3
- package/dist/infrastructure/projection/react/useViewIsCheckoutIntroVisible.js +0 -3
- package/dist/infrastructure/ui/components/atoms/spiner/Spinner.js +0 -11
- package/dist/infrastructure/ui/test/render.d.ts +0 -19
- package/dist/infrastructure/ui/test/render.js +0 -14
- package/jest.config.js +0 -9
- package/jest.setup.js +0 -3
- package/src/Expo.tsx +0 -59
- package/src/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.test.ts +0 -26
- package/src/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.ts +0 -27
- package/src/domain/checkoutBooking/model/checkoutBooking.test.ts +0 -30
- package/src/domain/checkoutBooking/model/checkoutBooking.ts +0 -31
- package/src/domain/checkoutBooking/model/checkoutBookingBooked.test.ts +0 -23
- package/src/domain/checkoutBooking/model/checkoutBookingBooked.ts +0 -23
- package/src/domain/checkoutBooking/model/checkoutBookings.ts +0 -6
- package/src/domain/uiSetting/command/updateUiSetting.test.ts +0 -19
- package/src/domain/uiSetting/command/updateUiSetting.ts +0 -23
- package/src/domain/uiSetting/model/uiSetting.test.ts +0 -26
- package/src/domain/uiSetting/model/uiSetting.ts +0 -22
- package/src/domain/uiSetting/model/uiSettingUpdated.test.ts +0 -17
- package/src/domain/uiSetting/model/uiSettingUpdated.ts +0 -19
- package/src/domain/uiSetting/model/uiSettings.ts +0 -6
- package/src/index.ts +0 -44
- package/src/infrastructure/delivery/_mock/bootstrap.mock.ts +0 -38
- package/src/infrastructure/delivery/_mock/checkout.mock.ts +0 -81
- package/src/infrastructure/delivery/bootstrap.ts +0 -42
- package/src/infrastructure/delivery/http/fetchHttpClient.test.ts +0 -51
- package/src/infrastructure/delivery/http/fetchHttpClient.ts +0 -41
- package/src/infrastructure/delivery/http/httpClient.ts +0 -18
- package/src/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.test.ts +0 -45
- package/src/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.ts +0 -32
- package/src/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.test.ts +0 -38
- package/src/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.ts +0 -44
- package/src/infrastructure/domain/react/useUpdateUiSetting.test.ts +0 -31
- package/src/infrastructure/domain/react/useUpdateUiSetting.ts +0 -43
- package/src/infrastructure/domain/uiSetting/model/storageUiSettings.test.ts +0 -50
- package/src/infrastructure/domain/uiSetting/model/storageUiSettings.ts +0 -50
- package/src/infrastructure/persistence/asyncStorageStorage.ts +0 -12
- package/src/infrastructure/persistence/storage.ts +0 -7
- package/src/infrastructure/persistence/uiSettingData.ts +0 -5
- package/src/infrastructure/projection/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.test.ts +0 -65
- package/src/infrastructure/projection/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.ts +0 -102
- package/src/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.test.ts +0 -99
- package/src/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.ts +0 -128
- package/src/infrastructure/projection/httpIsCheckoutEnabledByCustomerIdView.test.ts +0 -32
- package/src/infrastructure/projection/httpIsCheckoutEnabledByCustomerIdView.ts +0 -27
- package/src/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.test.ts +0 -51
- package/src/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.ts +0 -25
- package/src/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.test.ts +0 -28
- package/src/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.ts +0 -22
- package/src/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.test.ts +0 -44
- package/src/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.ts +0 -24
- package/src/infrastructure/projection/react/useViewIsCheckoutIntroVisible.ts +0 -5
- package/src/infrastructure/projection/react/useViewUiSettingByKey.test.ts +0 -30
- package/src/infrastructure/projection/react/useViewUiSettingByKey.ts +0 -18
- package/src/infrastructure/projection/storageUiSettingByKeyView.test.ts +0 -32
- package/src/infrastructure/projection/storageUiSettingByKeyView.ts +0 -35
- package/src/infrastructure/ui/Root.tsx +0 -53
- package/src/infrastructure/ui/components/atoms/spiner/Spinner.style.ts +0 -12
- package/src/infrastructure/ui/components/atoms/spiner/Spinner.tsx +0 -35
- package/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.test.tsx +0 -70
- package/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.tsx +0 -31
- package/src/infrastructure/ui/routing/CheckoutMiddleware.test.tsx +0 -100
- package/src/infrastructure/ui/routing/CheckoutMiddleware.tsx +0 -52
- package/src/infrastructure/ui/routing/Routing.tsx +0 -64
- package/src/infrastructure/ui/routing/router/Router.native.ts +0 -1
- package/src/infrastructure/ui/routing/router/Router.ts +0 -1
- package/src/infrastructure/ui/routing/routes.ts +0 -6
- package/src/infrastructure/ui/test/render.tsx +0 -47
- package/src/infrastructure/ui/views/intro/Intro.test.tsx +0 -15
- package/src/infrastructure/ui/views/intro/Intro.tsx +0 -27
- package/src/infrastructure/ui/views/item/Item.tsx +0 -31
- package/src/infrastructure/ui/views/summary/Summary.tsx +0 -27
- package/src/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.test.ts +0 -40
- package/src/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.ts +0 -85
- package/src/projection/checkout/viewFirstAvailableCheckoutByCustomerId.test.ts +0 -22
- package/src/projection/checkout/viewFirstAvailableCheckoutByCustomerId.ts +0 -149
- package/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.test.ts +0 -54
- package/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.ts +0 -46
- package/src/projection/checkout/viewIsCheckoutEnabledByCustomerId.test.ts +0 -20
- package/src/projection/checkout/viewIsCheckoutEnabledByCustomerId.ts +0 -51
- package/src/projection/uiSetting/viewUiSettingByKey.test.ts +0 -22
- package/src/projection/uiSetting/viewUiSettingByKey.ts +0 -47
- package/tsconfig.build.json +0 -16
- package/tsconfig.json +0 -19
- package/webpack.config.js +0 -17
- /package/dist/infrastructure/ui/components/atoms/{spiner → spinner}/Spinner.d.ts +0 -0
- /package/dist/infrastructure/ui/components/atoms/{spiner → spinner}/Spinner.style.d.ts +0 -0
- /package/dist/infrastructure/ui/components/atoms/{spiner → spinner}/Spinner.style.js +0 -0
package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Command } from "@lookiero/messaging";
|
|
2
|
-
|
|
2
|
+
declare const BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "book_size_replaceable_product_variants_for_checkout_item";
|
|
3
3
|
interface BookSizeReplaceableProductVariantsForCheckoutItemPayload {
|
|
4
4
|
readonly aggregateId: string;
|
|
5
5
|
readonly checkoutId: string;
|
|
6
6
|
readonly checkoutItemId: string;
|
|
7
7
|
readonly checkoutBookingId: string;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
interface BookSizeReplaceableProductVariantsForCheckoutItem extends Command<typeof BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM>, BookSizeReplaceableProductVariantsForCheckoutItemPayload {
|
|
10
10
|
}
|
|
11
11
|
interface BookSizeReplaceableProductVariantsForCheckoutItemFunction {
|
|
12
12
|
(payload: BookSizeReplaceableProductVariantsForCheckoutItemPayload): BookSizeReplaceableProductVariantsForCheckoutItem;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
export {};
|
|
14
|
+
declare const bookSizeReplaceableProductVariantsForCheckoutItem: BookSizeReplaceableProductVariantsForCheckoutItemFunction;
|
|
15
|
+
export { BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, BookSizeReplaceableProductVariantsForCheckoutItem, bookSizeReplaceableProductVariantsForCheckoutItem, };
|
package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { command } from "@lookiero/messaging";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "book_size_replaceable_product_variants_for_checkout_item";
|
|
3
|
+
const bookSizeReplaceableProductVariantsForCheckoutItem = ({ aggregateId, ...payload }) => ({
|
|
4
4
|
...command({ aggregateId, name: BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM }),
|
|
5
5
|
...payload,
|
|
6
6
|
});
|
|
7
|
+
export { BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, bookSizeReplaceableProductVariantsForCheckoutItem, };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
|
|
2
2
|
import { BookSizeReplaceableProductVariantsForCheckoutItem } from "../command/bookSizeReplaceableProductVariantsForCheckoutItem";
|
|
3
|
-
|
|
3
|
+
interface CheckoutBooking extends AggregateRoot {
|
|
4
4
|
readonly checkoutId: string;
|
|
5
5
|
readonly checkoutItemId: string;
|
|
6
6
|
readonly checkoutBookingId: string;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
declare const bookSizeReplaceableProductVariantsForCheckoutItemHandler: CommandHandlerFunction<BookSizeReplaceableProductVariantsForCheckoutItem, CheckoutBooking>;
|
|
9
|
+
export { CheckoutBooking, bookSizeReplaceableProductVariantsForCheckoutItemHandler };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { checkoutBookingBooked } from "./checkoutBookingBooked";
|
|
2
|
-
|
|
2
|
+
const bookSizeReplaceableProductVariantsForCheckoutItemHandler = () => async ({ aggregateRoot, command }) => {
|
|
3
3
|
const { aggregateId, checkoutId, checkoutItemId, checkoutBookingId } = command;
|
|
4
4
|
return {
|
|
5
5
|
...aggregateRoot,
|
|
@@ -14,3 +14,4 @@ export const bookSizeReplaceableProductVariantsForCheckoutItemHandler = () => as
|
|
|
14
14
|
}),
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
+
export { bookSizeReplaceableProductVariantsForCheckoutItemHandler };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { DomainEvent } from "@lookiero/messaging";
|
|
2
|
-
|
|
2
|
+
declare const CHECKOUT_BOOKING_BOOKED = "checkout_booking_booked";
|
|
3
3
|
interface CheckoutBookingBookedPayload {
|
|
4
4
|
readonly aggregateId: string;
|
|
5
5
|
readonly checkoutId: string;
|
|
6
6
|
readonly checkoutItemId: string;
|
|
7
7
|
readonly checkoutBookingId: string;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
interface CheckoutBookingBooked extends DomainEvent<typeof CHECKOUT_BOOKING_BOOKED>, CheckoutBookingBookedPayload {
|
|
10
10
|
}
|
|
11
11
|
interface CheckoutBookingBookedFunction {
|
|
12
12
|
(payload: CheckoutBookingBookedPayload): CheckoutBookingBooked;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
export {};
|
|
14
|
+
declare const checkoutBookingBooked: CheckoutBookingBookedFunction;
|
|
15
|
+
export { CHECKOUT_BOOKING_BOOKED, CheckoutBookingBooked, checkoutBookingBooked };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { domainEvent } from "@lookiero/messaging";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const CHECKOUT_BOOKING_BOOKED = "checkout_booking_booked";
|
|
3
|
+
const checkoutBookingBooked = ({ aggregateId, ...payload }) => ({
|
|
4
4
|
...domainEvent({ aggregateId, name: CHECKOUT_BOOKING_BOOKED }),
|
|
5
5
|
...payload,
|
|
6
6
|
});
|
|
7
|
+
export { CHECKOUT_BOOKING_BOOKED, checkoutBookingBooked };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RepositoryGetFunction, RepositorySaveFunction } from "@lookiero/messaging";
|
|
2
2
|
import { CheckoutBooking } from "./checkoutBooking";
|
|
3
|
-
|
|
3
|
+
interface CheckoutBookingsGetFunction extends RepositoryGetFunction<CheckoutBooking> {
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
interface CheckoutBookingsSaveFunction extends RepositorySaveFunction<CheckoutBooking> {
|
|
6
6
|
}
|
|
7
|
+
export { CheckoutBookingsGetFunction, CheckoutBookingsSaveFunction };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Command } from "@lookiero/messaging";
|
|
2
|
-
|
|
2
|
+
declare const UPDATE_UI_SETTING = "update_ui_setting";
|
|
3
3
|
interface UpdateUiSettingPayload {
|
|
4
4
|
readonly aggregateId: string;
|
|
5
5
|
readonly key: string;
|
|
6
6
|
readonly value: unknown;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
interface UpdateUiSetting extends Command<typeof UPDATE_UI_SETTING>, UpdateUiSettingPayload {
|
|
9
9
|
}
|
|
10
10
|
interface UpdateUiSettingFunction {
|
|
11
11
|
(payload: UpdateUiSettingPayload): UpdateUiSetting;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
export {};
|
|
13
|
+
declare const updateUiSetting: UpdateUiSettingFunction;
|
|
14
|
+
export { UPDATE_UI_SETTING, UpdateUiSetting, updateUiSetting };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { command } from "@lookiero/messaging";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const UPDATE_UI_SETTING = "update_ui_setting";
|
|
3
|
+
const updateUiSetting = ({ aggregateId, ...payload }) => ({
|
|
4
4
|
...command({
|
|
5
5
|
aggregateId,
|
|
6
6
|
name: UPDATE_UI_SETTING,
|
|
7
7
|
}),
|
|
8
8
|
...payload,
|
|
9
9
|
});
|
|
10
|
+
export { UPDATE_UI_SETTING, updateUiSetting };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { AggregateRoot } from "@lookiero/messaging";
|
|
2
2
|
import { CommandHandlerFunction } from "@lookiero/messaging/domain/model";
|
|
3
3
|
import { UpdateUiSetting } from "../command/updateUiSetting";
|
|
4
|
-
|
|
4
|
+
interface UiSetting extends AggregateRoot {
|
|
5
5
|
readonly key: string;
|
|
6
6
|
readonly value: unknown;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
declare const updateUiSettingHandler: CommandHandlerFunction<UpdateUiSetting, UiSetting>;
|
|
9
|
+
export { UiSetting, updateUiSettingHandler };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { uiSettingUpdated } from "./uiSettingUpdated";
|
|
2
|
-
|
|
2
|
+
const updateUiSettingHandler = () => async ({ aggregateRoot, command }) => {
|
|
3
3
|
const { aggregateId, key, value } = command;
|
|
4
4
|
return {
|
|
5
5
|
...aggregateRoot,
|
|
@@ -8,3 +8,4 @@ export const updateUiSettingHandler = () => async ({ aggregateRoot, command }) =
|
|
|
8
8
|
domainEvents: uiSettingUpdated({ aggregateId, key }),
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
+
export { updateUiSettingHandler };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { DomainEvent } from "@lookiero/messaging";
|
|
2
|
-
|
|
2
|
+
declare const UI_SETTING_UPDATED = "ui_setting_updated";
|
|
3
3
|
interface UiSettingUpdatedPayload {
|
|
4
4
|
readonly aggregateId: string;
|
|
5
5
|
readonly key: string;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
interface UiSettingUpdated extends DomainEvent<typeof UI_SETTING_UPDATED>, UiSettingUpdatedPayload {
|
|
8
8
|
}
|
|
9
9
|
interface UiSettingUpdatedFunction {
|
|
10
10
|
(payload: UiSettingUpdatedPayload): UiSettingUpdated;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
export {};
|
|
12
|
+
declare const uiSettingUpdated: UiSettingUpdatedFunction;
|
|
13
|
+
export { UI_SETTING_UPDATED, UiSettingUpdated, uiSettingUpdated };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { domainEvent } from "@lookiero/messaging";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const UI_SETTING_UPDATED = "ui_setting_updated";
|
|
3
|
+
const uiSettingUpdated = ({ aggregateId, key }) => ({
|
|
4
4
|
...domainEvent({ aggregateId, name: UI_SETTING_UPDATED }),
|
|
5
5
|
key,
|
|
6
6
|
});
|
|
7
|
+
export { UI_SETTING_UPDATED, uiSettingUpdated };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RepositoryGetFunction, RepositorySaveFunction } from "@lookiero/messaging";
|
|
2
2
|
import { UiSetting } from "./uiSetting";
|
|
3
|
-
|
|
3
|
+
interface UiSettingGetFunction extends RepositoryGetFunction<UiSetting> {
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
interface UiSettingSaveFunction extends RepositorySaveFunction<UiSetting> {
|
|
6
6
|
}
|
|
7
|
+
export { UiSettingGetFunction, UiSettingSaveFunction };
|
|
@@ -2,10 +2,11 @@ import { bootstrap as messagingBootstrap } from "@lookiero/messaging-react";
|
|
|
2
2
|
import { CheckoutItemStatus, viewFirstAvailableCheckoutByCustomerIdHandler, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, } from "../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
3
3
|
import { viewIsCheckoutAccessibleByCustomerIdHandler, VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, } from "../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
4
4
|
import { viewIsCheckoutEnabledByCustomerIdHandler, VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, } from "../../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
|
|
5
|
+
import { CHECKOUT_MESSAGING_REACT_ID } from "../bootstrap";
|
|
5
6
|
import { startedCheckoutWithItems } from "./checkout.mock";
|
|
6
7
|
const firstAvailableCheckoutByCustomerIdView = async () => startedCheckoutWithItems({ status: [CheckoutItemStatus.KEPT, CheckoutItemStatus.INITIAL] });
|
|
7
8
|
const isCheckoutEnabledByCustomerIdView = async () => true;
|
|
8
|
-
const bootstrap = () => messagingBootstrap({ id:
|
|
9
|
+
const bootstrap = () => messagingBootstrap({ id: CHECKOUT_MESSAGING_REACT_ID })
|
|
9
10
|
.query(VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerIdHandler, {
|
|
10
11
|
view: firstAvailableCheckoutByCustomerIdView,
|
|
11
12
|
})
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BuildBootstrapFunctionReturn } from "@lookiero/messaging-react";
|
|
2
|
+
declare const CHECKOUT_MESSAGING_REACT_ID = "Checkout";
|
|
2
3
|
interface BootstrapFunctionArgs {
|
|
3
4
|
readonly getAuthToken: () => string;
|
|
4
5
|
readonly apiUrl: string;
|
|
@@ -7,4 +8,4 @@ interface BootstrapFunction {
|
|
|
7
8
|
(args: BootstrapFunctionArgs): BuildBootstrapFunctionReturn;
|
|
8
9
|
}
|
|
9
10
|
declare const bootstrap: BootstrapFunction;
|
|
10
|
-
export { bootstrap };
|
|
11
|
+
export { bootstrap, CHECKOUT_MESSAGING_REACT_ID };
|
|
@@ -5,10 +5,11 @@ import { viewIsCheckoutEnabledByCustomerIdHandler, VIEW_IS_CHECKOUT_ENABLED_BY_C
|
|
|
5
5
|
import { httpFirstAvailableCheckoutByCustomerIdView } from "../projection/httpFirstAvailableCheckoutByCustomerIdView";
|
|
6
6
|
import { httpIsCheckoutEnabledByCustomerIdView } from "../projection/httpIsCheckoutEnabledByCustomerIdView";
|
|
7
7
|
import { fetchHttpGet, fetchHttpPost } from "./http/fetchHttpClient";
|
|
8
|
+
const CHECKOUT_MESSAGING_REACT_ID = "Checkout";
|
|
8
9
|
const bootstrap = ({ apiUrl, getAuthToken }) => {
|
|
9
10
|
const httpGet = fetchHttpGet({ apiUrl, getAuthToken });
|
|
10
11
|
const httpPost = fetchHttpPost({ apiUrl, getAuthToken });
|
|
11
|
-
return messagingBootstrap({ id:
|
|
12
|
+
return messagingBootstrap({ id: CHECKOUT_MESSAGING_REACT_ID })
|
|
12
13
|
.query(VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerIdHandler, {
|
|
13
14
|
view: httpFirstAvailableCheckoutByCustomerIdView({ httpPost }),
|
|
14
15
|
})
|
|
@@ -18,4 +19,4 @@ const bootstrap = ({ apiUrl, getAuthToken }) => {
|
|
|
18
19
|
.query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler, {})
|
|
19
20
|
.build();
|
|
20
21
|
};
|
|
21
|
-
export { bootstrap };
|
|
22
|
+
export { bootstrap, CHECKOUT_MESSAGING_REACT_ID };
|
|
@@ -6,5 +6,5 @@ interface HttpCheckoutBookingsSaveFunctionArgs {
|
|
|
6
6
|
interface HttpCheckoutBookingsSaveFunction {
|
|
7
7
|
(args: HttpCheckoutBookingsSaveFunctionArgs): CheckoutBookingsSaveFunction;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
export {};
|
|
9
|
+
declare const saveCheckoutBooking: HttpCheckoutBookingsSaveFunction;
|
|
10
|
+
export { saveCheckoutBooking };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const saveCheckoutBooking = ({ httpPost }) => async ({ checkoutId, checkoutItemId, checkoutBookingId }) => {
|
|
2
2
|
try {
|
|
3
3
|
const response = await httpPost({
|
|
4
4
|
endpoint: "/book-size-replaceable-product-variants-for-checkout-item",
|
|
@@ -17,3 +17,4 @@ export const saveCheckoutBooking = ({ httpPost }) => async ({ checkoutId, checko
|
|
|
17
17
|
throw new Error("Could not fetch BookSizeReplaceableProductVariantsForCheckoutItem");
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
+
export { saveCheckoutBooking };
|
package/dist/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ interface UseBookSizeReplaceableProductVariantsForCheckoutItemFunctionArgs {
|
|
|
11
11
|
interface UseBookSizeReplaceableProductVariantsForCheckoutItemFunction {
|
|
12
12
|
(args: UseBookSizeReplaceableProductVariantsForCheckoutItemFunctionArgs): UseBookSizeReplaceableProductVariantsForCheckoutItem;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
export {};
|
|
14
|
+
declare const useBookSizeReplaceableProductVariantsForCheckoutItem: UseBookSizeReplaceableProductVariantsForCheckoutItemFunction;
|
|
15
|
+
export { useBookSizeReplaceableProductVariantsForCheckoutItem };
|
package/dist/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.js
CHANGED
|
@@ -2,7 +2,7 @@ import { useCommand } from "@lookiero/messaging-react";
|
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { v4 as uuid } from "uuid";
|
|
4
4
|
import { bookSizeReplaceableProductVariantsForCheckoutItem } from "../../../domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem";
|
|
5
|
-
|
|
5
|
+
const useBookSizeReplaceableProductVariantsForCheckoutItem = ({ checkoutId, checkoutItemId, checkoutBookingId }) => {
|
|
6
6
|
const [commandBus, status] = useCommand();
|
|
7
7
|
const book = useCallback(async () => await commandBus(bookSizeReplaceableProductVariantsForCheckoutItem({
|
|
8
8
|
aggregateId: uuid(),
|
|
@@ -15,3 +15,4 @@ export const useBookSizeReplaceableProductVariantsForCheckoutItem = ({ checkoutI
|
|
|
15
15
|
status,
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
+
export { useBookSizeReplaceableProductVariantsForCheckoutItem };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
interface SetCheckoutIntroShownFunction {
|
|
3
|
+
(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
interface UseSetCheckoutIntroShown {
|
|
6
|
+
readonly setCheckoutIntroShown: SetCheckoutIntroShownFunction;
|
|
7
|
+
readonly status: CommandStatus;
|
|
8
|
+
}
|
|
9
|
+
interface UseSetCheckoutIntroShownFunction {
|
|
10
|
+
(): UseSetCheckoutIntroShown;
|
|
11
|
+
}
|
|
12
|
+
declare const useSetCheckoutIntroShown: UseSetCheckoutIntroShownFunction;
|
|
13
|
+
export { useSetCheckoutIntroShown };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { UISettings } from "../../ui/settings/UISettings";
|
|
3
|
+
import { useUpdateUiSetting } from "./useUpdateUiSetting";
|
|
4
|
+
const useSetCheckoutIntroShown = () => {
|
|
5
|
+
const { update, status } = useUpdateUiSetting();
|
|
6
|
+
const setCheckoutIntroShown = useCallback(() => update({ key: UISettings.CHECKOUT_INTRO_SHOWN, value: true }), [update]);
|
|
7
|
+
return { setCheckoutIntroShown, status };
|
|
8
|
+
};
|
|
9
|
+
export { useSetCheckoutIntroShown };
|
|
@@ -13,5 +13,5 @@ interface UseUpdateUiSetting {
|
|
|
13
13
|
interface UseUpdateUiSettingFunction {
|
|
14
14
|
(): UseUpdateUiSetting;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
export {};
|
|
16
|
+
declare const useUpdateUiSetting: UseUpdateUiSettingFunction;
|
|
17
|
+
export { useUpdateUiSetting };
|
|
@@ -2,7 +2,7 @@ import { useCommand } from "@lookiero/messaging-react";
|
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { v4 as uuid } from "uuid";
|
|
4
4
|
import { updateUiSetting } from "../../../domain/uiSetting/command/updateUiSetting";
|
|
5
|
-
|
|
5
|
+
const useUpdateUiSetting = () => {
|
|
6
6
|
const [commandBus, status] = useCommand();
|
|
7
7
|
const update = useCallback(async ({ key, value }) => await commandBus(updateUiSetting({
|
|
8
8
|
aggregateId: uuid(),
|
|
@@ -14,3 +14,4 @@ export const useUpdateUiSetting = () => {
|
|
|
14
14
|
status,
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
+
export { useUpdateUiSetting };
|
|
@@ -7,12 +7,12 @@ interface StorageUiSettingsGetFunctionArgs {
|
|
|
7
7
|
interface StorageUiSettingsGetFunction {
|
|
8
8
|
(args: StorageUiSettingsGetFunctionArgs): UiSettingGetFunction;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
declare const getUiSetting: StorageUiSettingsGetFunction;
|
|
11
11
|
interface StorageUiSettingsSaveFunctionArgs {
|
|
12
12
|
readonly write: WriteFunction<UiSettingDto>;
|
|
13
13
|
}
|
|
14
14
|
interface StorageUiSettingsSaveFunction {
|
|
15
15
|
(args: StorageUiSettingsSaveFunctionArgs): UiSettingSaveFunction;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
export {};
|
|
17
|
+
declare const saveUiSetting: StorageUiSettingsSaveFunction;
|
|
18
|
+
export { getUiSetting, saveUiSetting };
|
|
@@ -9,11 +9,12 @@ const fromDomain = (uiSetting) => ({
|
|
|
9
9
|
key: uiSetting.key,
|
|
10
10
|
value: uiSetting.value,
|
|
11
11
|
});
|
|
12
|
-
|
|
12
|
+
const getUiSetting = ({ read }) => async (uiSettingKey) => {
|
|
13
13
|
const uiSettingDto = await read(uiSettingKey);
|
|
14
14
|
if (!uiSettingDto) {
|
|
15
15
|
throw new Error(`UiSetting not found: ${uiSettingKey}`);
|
|
16
16
|
}
|
|
17
17
|
return toDomain(uiSettingDto);
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
const saveUiSetting = ({ write }) => async (aggregateRoot) => await write(aggregateRoot.key, fromDomain(aggregateRoot));
|
|
20
|
+
export { getUiSetting, saveUiSetting };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReadFunction, WriteFunction } from "./storage";
|
|
2
2
|
import { UiSettingDto } from "./uiSettingData";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
declare const read: ReadFunction<UiSettingDto>;
|
|
4
|
+
declare const write: WriteFunction<UiSettingDto>;
|
|
5
|
+
export { read, write };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
2
|
-
|
|
2
|
+
const read = async (key) => {
|
|
3
3
|
const value = await AsyncStorage.getItem(key);
|
|
4
4
|
return value ? JSON.parse(value) : undefined;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
const write = async (key, value) => AsyncStorage.setItem(key, JSON.stringify(value));
|
|
7
|
+
export { read, write };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
interface ReadFunction<T> {
|
|
2
2
|
(key: string): Promise<T | undefined>;
|
|
3
3
|
}
|
|
4
|
-
|
|
4
|
+
interface WriteFunction<T> {
|
|
5
5
|
(key: string, value: T): Promise<void>;
|
|
6
6
|
}
|
|
7
|
+
export { ReadFunction, WriteFunction };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useQuery } from "@lookiero/messaging-react";
|
|
2
2
|
import { viewBookedSizeReplaceableProductVariantsForCheckoutItem, } from "../../../projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem";
|
|
3
|
+
import { CHECKOUT_MESSAGING_REACT_ID } from "../../delivery/bootstrap";
|
|
3
4
|
const useViewBookedSizeReplaceableProductVariantsForCheckoutItem = ({ checkoutItemId }) => useQuery({
|
|
4
5
|
query: viewBookedSizeReplaceableProductVariantsForCheckoutItem({ checkoutItemId }),
|
|
5
|
-
contextId:
|
|
6
|
+
contextId: CHECKOUT_MESSAGING_REACT_ID,
|
|
6
7
|
options: { staleTime: Infinity },
|
|
7
8
|
});
|
|
8
9
|
export { useViewBookedSizeReplaceableProductVariantsForCheckoutItem };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UISettings } from "../../ui/settings/UISettings";
|
|
2
|
+
import { useViewUiSettingByKey } from "./useViewUiSettingByKey";
|
|
3
|
+
const useViewCheckoutIntroShown = () => useViewUiSettingByKey({
|
|
4
|
+
key: UISettings.CHECKOUT_INTRO_SHOWN,
|
|
5
|
+
});
|
|
6
|
+
export { useViewCheckoutIntroShown };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useQuery } from "@lookiero/messaging-react";
|
|
2
2
|
import { viewFirstAvailableCheckoutByCustomerId, } from "../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
3
|
+
import { CHECKOUT_MESSAGING_REACT_ID } from "../../delivery/bootstrap";
|
|
3
4
|
const useViewFirstAvailableCheckoutByCustomerId = ({ customerId }) => useQuery({
|
|
4
5
|
query: viewFirstAvailableCheckoutByCustomerId({ customerId }),
|
|
5
|
-
contextId:
|
|
6
|
+
contextId: CHECKOUT_MESSAGING_REACT_ID,
|
|
6
7
|
options: { staleTime: Infinity, retry: false },
|
|
7
8
|
});
|
|
8
9
|
export { useViewFirstAvailableCheckoutByCustomerId };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useQuery } from "@lookiero/messaging-react";
|
|
2
2
|
import { viewIsCheckoutAccessibleByCustomerId, } from "../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
3
|
+
import { CHECKOUT_MESSAGING_REACT_ID } from "../../delivery/bootstrap";
|
|
3
4
|
const useViewIsCheckoutAccessibleByCustomerId = ({ customerId }) => useQuery({
|
|
4
5
|
query: viewIsCheckoutAccessibleByCustomerId({ customerId }),
|
|
5
|
-
contextId:
|
|
6
|
+
contextId: CHECKOUT_MESSAGING_REACT_ID,
|
|
6
7
|
options: { staleTime: Infinity },
|
|
7
8
|
});
|
|
8
9
|
export { useViewIsCheckoutAccessibleByCustomerId };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
2
|
import { UiSettingProjection } from "../../../projection/uiSetting/viewUiSettingByKey";
|
|
3
3
|
interface UseViewUiSettingByKeyFunctionArgs {
|
|
4
|
-
readonly
|
|
4
|
+
readonly key: string;
|
|
5
5
|
}
|
|
6
6
|
interface UseViewUiSettingByKeyFunction {
|
|
7
7
|
(args: UseViewUiSettingByKeyFunctionArgs): UseQueryFunctionResult<UiSettingProjection>;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
export {};
|
|
9
|
+
declare const useViewUiSettingByKey: UseViewUiSettingByKeyFunction;
|
|
10
|
+
export { useViewUiSettingByKey };
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
-
import {
|
|
2
|
+
import { UI_SETTING_UPDATED } from "../../../domain/uiSetting/model/uiSettingUpdated";
|
|
3
3
|
import { viewUiSettingByKey } from "../../../projection/uiSetting/viewUiSettingByKey";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { CHECKOUT_MESSAGING_REACT_ID } from "../../delivery/bootstrap";
|
|
5
|
+
const isUiSettingUpdated = (event) => event.name === UI_SETTING_UPDATED;
|
|
6
|
+
const useViewUiSettingByKey = ({ key }) => useQuery({
|
|
7
|
+
query: viewUiSettingByKey({ key }),
|
|
8
|
+
contextId: CHECKOUT_MESSAGING_REACT_ID,
|
|
9
|
+
invalidation: isUiSettingUpdated,
|
|
10
|
+
options: { staleTime: Infinity, retry: false },
|
|
8
11
|
});
|
|
12
|
+
export { useViewUiSettingByKey };
|
|
@@ -9,5 +9,5 @@ interface StorageUiSettingByKeyViewFunctionArgs {
|
|
|
9
9
|
interface StorageUiSettingByKeyViewFunction {
|
|
10
10
|
(args: StorageUiSettingByKeyViewFunctionArgs): StorageUiSettingByKeyView;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
export {};
|
|
12
|
+
declare const storageUiSettingByKeyView: StorageUiSettingByKeyViewFunction;
|
|
13
|
+
export { storageUiSettingByKeyView };
|
|
@@ -3,7 +3,7 @@ const toUiSettingProjection = (uiSettingDto) => ({
|
|
|
3
3
|
key: uiSettingDto.key,
|
|
4
4
|
value: uiSettingDto.value,
|
|
5
5
|
});
|
|
6
|
-
|
|
6
|
+
const storageUiSettingByKeyView = ({ read }) => async ({ key }) => {
|
|
7
7
|
try {
|
|
8
8
|
const uiSettingDto = await read(key);
|
|
9
9
|
return uiSettingDto ? toUiSettingProjection(uiSettingDto) : undefined;
|
|
@@ -12,3 +12,4 @@ export const storageUiSettingByKeyView = ({ read }) => async ({ key }) => {
|
|
|
12
12
|
throw new Error("Could not fetch the uiSetting");
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
+
export { storageUiSettingByKeyView };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { inMemoryFetchTranslation } from "@lookiero/i18n";
|
|
2
|
-
import {
|
|
3
|
-
import { useCallback } from "react";
|
|
2
|
+
import { i18n } from "@lookiero/i18n-react";
|
|
3
|
+
import React, { useCallback } from "react";
|
|
4
4
|
import { Platform } from "react-native";
|
|
5
|
-
import { Spinner } from "./components/atoms/
|
|
5
|
+
import { Spinner } from "./components/atoms/spinner/Spinner";
|
|
6
6
|
import { Router } from "./routing/router/Router";
|
|
7
7
|
import { Routing } from "./routing/Routing";
|
|
8
8
|
const translationData = {
|
|
@@ -10,16 +10,14 @@ const translationData = {
|
|
|
10
10
|
es: { intro: "Título de la vista Intro" },
|
|
11
11
|
};
|
|
12
12
|
const fetchTranslation = inMemoryFetchTranslation({ translationData });
|
|
13
|
+
const I18n = i18n({ fetchTranslation, contextId: "CheckoutI18n" });
|
|
13
14
|
const root = ({ Messaging }) =>
|
|
14
15
|
// eslint-disable-next-line react/display-name, react/prop-types
|
|
15
16
|
({ locale = "en", customerId, onNotAccessible }) => {
|
|
16
17
|
const handleOnI18nError = useCallback(() => void 0, []);
|
|
17
|
-
return (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
</Router>
|
|
22
|
-
</Messaging>
|
|
23
|
-
</ReactIntl.I18n>);
|
|
18
|
+
return (React.createElement(I18n, { locale: locale, loader: React.createElement(Spinner, null), onError: handleOnI18nError },
|
|
19
|
+
React.createElement(Messaging, { includeReactQueryDevTools: Platform.OS === "web" },
|
|
20
|
+
React.createElement(Router, null,
|
|
21
|
+
React.createElement(Routing, { customerId: customerId, onNotAccessible: onNotAccessible })))));
|
|
24
22
|
};
|
|
25
23
|
export { root };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { style } from "./Spinner.style";
|
|
4
|
+
const Spinner = () => (React.createElement(View, { style: style.container },
|
|
5
|
+
React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "30px", height: "30px", viewBox: "0 0 100 100", preserveAspectRatio: "xMidYMid" },
|
|
6
|
+
React.createElement("circle", { cx: "50", cy: "50", r: "32", stroke: "#000000", strokeWidth: "6", strokeLinecap: "round", fill: "none" },
|
|
7
|
+
React.createElement("animateTransform", { attributeName: "transform", type: "rotate", repeatCount: "indefinite", dur: "1.5384615384615383s", values: "0 50 50;180 50 50;720 50 50", keyTimes: "0;0.5;1" }),
|
|
8
|
+
React.createElement("animate", { attributeName: "stroke-dasharray", repeatCount: "indefinite", dur: "1.5384615384615383s", values: "42.22300526424682 158.83892456549995;176.93449825017714 24.127431579569617;42.22300526424682 158.83892456549995", keyTimes: "0;0.5;1" })))));
|
|
9
|
+
export { Spinner };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useEffect, useRef } from "react";
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
2
|
import { Outlet } from "react-router-native";
|
|
3
3
|
import { useViewIsCheckoutAccessibleByCustomerId } from "../../projection/react/useViewIsCheckoutAccessibleByCustomerId";
|
|
4
|
-
import { Spinner } from "../components/atoms/
|
|
5
|
-
const CheckoutAccessibilityMiddleware = ({ customerId, onNotAccessible, loader =
|
|
4
|
+
import { Spinner } from "../components/atoms/spinner/Spinner";
|
|
5
|
+
const CheckoutAccessibilityMiddleware = ({ customerId, onNotAccessible, loader = React.createElement(Spinner, null), }) => {
|
|
6
6
|
const [accessible] = useViewIsCheckoutAccessibleByCustomerId({ customerId });
|
|
7
7
|
const onNotAccessibleRef = useRef(onNotAccessible);
|
|
8
8
|
onNotAccessibleRef.current = onNotAccessible;
|
|
@@ -11,6 +11,6 @@ const CheckoutAccessibilityMiddleware = ({ customerId, onNotAccessible, loader =
|
|
|
11
11
|
onNotAccessibleRef.current();
|
|
12
12
|
}
|
|
13
13
|
}, [accessible, onNotAccessible]);
|
|
14
|
-
return accessible === undefined ? loader : accessible ?
|
|
14
|
+
return accessible === undefined ? loader : accessible ? React.createElement(Outlet, null) : null;
|
|
15
15
|
};
|
|
16
16
|
export { CheckoutAccessibilityMiddleware };
|