@lookiero/checkout 0.2.10 → 0.2.11
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/README.md +3 -1
- package/dist/domain/checkout/model/checkout.js +1 -1
- package/dist/domain/checkoutBooking/model/checkoutBooking.js +7 -5
- package/dist/domain/uiSetting/model/uiSetting.js +1 -1
- package/dist/infrastructure/delivery/baseBootstrap.d.ts +7 -2
- package/dist/infrastructure/delivery/baseBootstrap.js +3 -3
- package/dist/infrastructure/delivery/bootstrap.js +2 -2
- package/dist/infrastructure/delivery/bootstrap.mock.js +2 -2
- package/dist/infrastructure/delivery/http/fetchHttpClient.js +4 -2
- package/dist/infrastructure/delivery/http/httpClient.d.ts +2 -0
- package/dist/infrastructure/projection/bookedSizeReplaceableProductVariants/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.js +9 -13
- package/dist/infrastructure/projection/checkout/httpCheckoutByIdView.js +2 -1
- package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.js +2 -1
- package/dist/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.js +2 -1
- package/dist/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.js +2 -1
- package/dist/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.d.ts +2 -2
- package/dist/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.js +2 -2
- package/dist/projection/checkout/viewCheckoutById.d.ts +2 -2
- package/dist/projection/checkout/viewCheckoutById.js +2 -2
- package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.d.ts +2 -2
- package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.js +2 -2
- package/dist/projection/checkout/viewFiveItemsDiscountByCustomerId.d.ts +2 -2
- package/dist/projection/checkout/viewFiveItemsDiscountByCustomerId.js +2 -2
- package/dist/projection/checkout/viewIsCheckoutEnabledByCustomerId.d.ts +2 -2
- package/dist/projection/checkout/viewIsCheckoutEnabledByCustomerId.js +2 -2
- package/package.json +9 -7
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
## 💡 Prerequisites
|
|
7
7
|
|
|
8
|
-
- Node.js
|
|
8
|
+
- Node.js ^14.20.0 | ^18.9.0
|
|
9
9
|
- NPM >= 8
|
|
10
10
|
|
|
11
11
|
## 🚀 Getting Started
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
This application is build over **Expo** so, the easiest way to install this library is through NPM.
|
|
14
14
|
|
|
15
15
|
```shell
|
|
16
|
+
$ nvm use
|
|
17
|
+
$ nvm install --latest-npm
|
|
16
18
|
$ npm install --legacy-peer-deps
|
|
17
19
|
```
|
|
18
20
|
|
|
@@ -14,7 +14,7 @@ const startCheckoutHandler = () => async ({ aggregateRoot, command }) => {
|
|
|
14
14
|
return {
|
|
15
15
|
...aggregateRoot,
|
|
16
16
|
status: CheckoutStatus.STARTED,
|
|
17
|
-
domainEvents: checkoutStarted({ aggregateId }),
|
|
17
|
+
domainEvents: [checkoutStarted({ aggregateId })],
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
export { CheckoutStatus, startCheckoutHandler };
|
|
@@ -5,11 +5,13 @@ const bookSizeReplaceableProductVariantsForCheckoutItemHandler = () => async ({
|
|
|
5
5
|
...aggregateRoot,
|
|
6
6
|
checkoutId,
|
|
7
7
|
checkoutItemId,
|
|
8
|
-
domainEvents:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
domainEvents: [
|
|
9
|
+
checkoutBookingBooked({
|
|
10
|
+
aggregateId,
|
|
11
|
+
checkoutId,
|
|
12
|
+
checkoutItemId,
|
|
13
|
+
}),
|
|
14
|
+
],
|
|
13
15
|
};
|
|
14
16
|
};
|
|
15
17
|
export { bookSizeReplaceableProductVariantsForCheckoutItemHandler };
|
|
@@ -5,7 +5,7 @@ const updateUiSettingHandler = () => async ({ aggregateRoot, command }) => {
|
|
|
5
5
|
...aggregateRoot,
|
|
6
6
|
key,
|
|
7
7
|
value,
|
|
8
|
-
domainEvents: uiSettingUpdated({ aggregateId, key }),
|
|
8
|
+
domainEvents: [uiSettingUpdated({ aggregateId, key })],
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
export { updateUiSettingHandler };
|
|
@@ -10,6 +10,7 @@ import { FiveItemsDiscountByCustomerIdView } from "../../projection/checkout/vie
|
|
|
10
10
|
import { IsCheckoutEnabledByCustomerIdView } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
|
|
11
11
|
import { UiSettingByKeyView } from "../../projection/uiSetting/viewUiSettingByKey";
|
|
12
12
|
declare const MESSAGING_CONTEXT_ID = "Checkout";
|
|
13
|
+
declare type NeverWhenEmptyRecord<K extends [Record<string, unknown>]> = K extends [Record<string, never>] ? [never?] : K;
|
|
13
14
|
declare type RepositoryDependencies<A extends AggregateRoot, GetFunctionArgs extends RepositoryGetFunctionArgs, SaveFunctionArgs extends RepositorySaveFunctionArgs> = Omit<Parameters<RepositoryGetFunction<A, GetFunctionArgs>>[0] & Parameters<RepositorySaveFunction<A, SaveFunctionArgs>>[0], keyof RepositoryGetFunctionArgs>;
|
|
14
15
|
interface BaseBootstrapFunctionArgs<UiSettingGetFunctionArgs extends RepositoryGetFunctionArgs, UiSettingSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutSaveFunctionArgs extends RepositorySaveFunctionArgs> {
|
|
15
16
|
readonly checkoutByIdView: CheckoutByIdView;
|
|
@@ -19,10 +20,14 @@ interface BaseBootstrapFunctionArgs<UiSettingGetFunctionArgs extends RepositoryG
|
|
|
19
20
|
readonly uiSettingByKeyView: UiSettingByKeyView;
|
|
20
21
|
readonly getUiSetting: UiSettingGetFunction<UiSettingGetFunctionArgs>;
|
|
21
22
|
readonly saveUiSetting: UiSettingSaveFunction<UiSettingSaveFunctionArgs>;
|
|
22
|
-
readonly uiSettingsDependencies:
|
|
23
|
+
readonly uiSettingsDependencies: NeverWhenEmptyRecord<[
|
|
24
|
+
RepositoryDependencies<UiSetting, UiSettingGetFunctionArgs, UiSettingSaveFunctionArgs>
|
|
25
|
+
]>;
|
|
23
26
|
readonly getCheckout: CheckoutsGetFunction<CheckoutGetFunctionArgs>;
|
|
24
27
|
readonly saveCheckout: CheckoutsSaveFunction<CheckoutSaveFunctionArgs>;
|
|
25
|
-
readonly checkoutsDependencies:
|
|
28
|
+
readonly checkoutsDependencies: NeverWhenEmptyRecord<[
|
|
29
|
+
RepositoryDependencies<Checkout, CheckoutGetFunctionArgs, CheckoutSaveFunctionArgs>
|
|
30
|
+
]>;
|
|
26
31
|
}
|
|
27
32
|
interface BaseBootstrapFunction {
|
|
28
33
|
<UiSettingGetArgs extends RepositoryGetFunctionArgs, UiSettingSaveArgs extends RepositorySaveFunctionArgs, CheckoutGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutSaveFunctionArgs extends RepositorySaveFunctionArgs>(args: BaseBootstrapFunctionArgs<UiSettingGetArgs, UiSettingSaveArgs, CheckoutGetFunctionArgs, CheckoutSaveFunctionArgs>): BuildBootstrapFunctionReturn;
|
|
@@ -20,14 +20,14 @@ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdVie
|
|
|
20
20
|
.query(VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, viewIsCheckoutEnabledByCustomerIdHandler, {
|
|
21
21
|
view: isCheckoutEnabledByCustomerIdView,
|
|
22
22
|
})
|
|
23
|
-
.query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler
|
|
23
|
+
.query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler)
|
|
24
24
|
.query(VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, viewFiveItemsDiscountByCustomerIdHandler, {
|
|
25
25
|
view: fiveItemsDiscountByCustomerIdView,
|
|
26
26
|
})
|
|
27
27
|
.query(VIEW_UI_SETTING_BY_KEY, viewUiSettingByKeyHandler, {
|
|
28
28
|
view: uiSettingByKeyView,
|
|
29
29
|
})
|
|
30
|
-
.command(UPDATE_UI_SETTING, updateUiSettingHandler
|
|
31
|
-
.command(START_CHECKOUT, startCheckoutHandler
|
|
30
|
+
.command(UPDATE_UI_SETTING, updateUiSettingHandler)(getUiSetting, saveUiSetting, ...uiSettingsDependencies)
|
|
31
|
+
.command(START_CHECKOUT, startCheckoutHandler)(getCheckout, saveCheckout, ...checkoutsDependencies)
|
|
32
32
|
.build();
|
|
33
33
|
export { baseBootstrap, MESSAGING_CONTEXT_ID };
|
|
@@ -19,10 +19,10 @@ const bootstrap = ({ apiUrl, getAuthToken }) => {
|
|
|
19
19
|
uiSettingByKeyView: storageUiSettingByKeyView({ read }),
|
|
20
20
|
getUiSetting,
|
|
21
21
|
saveUiSetting,
|
|
22
|
-
uiSettingsDependencies: { read, write },
|
|
22
|
+
uiSettingsDependencies: [{ read, write }],
|
|
23
23
|
getCheckout,
|
|
24
24
|
saveCheckout,
|
|
25
|
-
checkoutsDependencies: { httpPost },
|
|
25
|
+
checkoutsDependencies: [{ httpPost }],
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
28
|
export { bootstrap };
|
|
@@ -55,9 +55,9 @@ const bootstrap = () => baseBootstrap({
|
|
|
55
55
|
uiSettingByKeyView: storageUiSettingByKeyView({ read }),
|
|
56
56
|
getUiSetting,
|
|
57
57
|
saveUiSetting,
|
|
58
|
-
uiSettingsDependencies: { read, write },
|
|
58
|
+
uiSettingsDependencies: [{ read, write }],
|
|
59
59
|
getCheckout,
|
|
60
60
|
saveCheckout,
|
|
61
|
-
checkoutsDependencies:
|
|
61
|
+
checkoutsDependencies: [],
|
|
62
62
|
});
|
|
63
63
|
export { bootstrap };
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
const fetchHttpPost = ({ apiUrl, getAuthToken }) => async ({ endpoint, body }) => fetch(`${apiUrl}${endpoint}`, {
|
|
1
|
+
const fetchHttpPost = ({ apiUrl, getAuthToken }) => async ({ endpoint, body, signal }) => fetch(`${apiUrl}${endpoint}`, {
|
|
2
2
|
method: "POST",
|
|
3
3
|
headers: {
|
|
4
4
|
["Content-Type"]: "application/json",
|
|
5
5
|
authorization: `Bearer ${await getAuthToken()}`,
|
|
6
6
|
},
|
|
7
7
|
body: JSON.stringify(body),
|
|
8
|
+
signal,
|
|
8
9
|
});
|
|
9
|
-
const fetchHttpGet = ({ apiUrl, getAuthToken }) => async ({ endpoint }) => fetch(`${apiUrl}${endpoint}`, {
|
|
10
|
+
const fetchHttpGet = ({ apiUrl, getAuthToken }) => async ({ endpoint, signal }) => fetch(`${apiUrl}${endpoint}`, {
|
|
10
11
|
method: "GET",
|
|
11
12
|
credentials: "include",
|
|
12
13
|
headers: {
|
|
13
14
|
authorization: `Bearer ${await getAuthToken()}`,
|
|
14
15
|
},
|
|
15
16
|
referrer: "",
|
|
17
|
+
signal,
|
|
16
18
|
});
|
|
17
19
|
export { fetchHttpGet, fetchHttpPost };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
interface HttpGetFunctionArgs {
|
|
2
2
|
readonly endpoint: string;
|
|
3
|
+
readonly signal?: AbortSignal;
|
|
3
4
|
}
|
|
4
5
|
interface HttpGetFunction {
|
|
5
6
|
(args: HttpGetFunctionArgs): Promise<Response>;
|
|
@@ -7,6 +8,7 @@ interface HttpGetFunction {
|
|
|
7
8
|
interface HttpPostFunctionArgs {
|
|
8
9
|
readonly endpoint: string;
|
|
9
10
|
readonly body: Record<string, unknown>;
|
|
11
|
+
readonly signal?: AbortSignal;
|
|
10
12
|
}
|
|
11
13
|
interface HttpPostFunction {
|
|
12
14
|
(args: HttpPostFunctionArgs): Promise<Response>;
|
|
@@ -13,18 +13,14 @@ const toBookedSizeReplaceableProductVariants = (bookedSizeReplaceableProductVari
|
|
|
13
13
|
booking: bookedSizeReplaceableProductVariants.booking,
|
|
14
14
|
productVariants: bookedSizeReplaceableProductVariants.product_variants.map(toProductVariant),
|
|
15
15
|
});
|
|
16
|
-
const httpBookedSizeReplaceableProductVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId }) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
catch (ignored) {
|
|
27
|
-
throw new Error("Could not fetch BookedSizeReplaceableProductVariantsForCheckoutItem");
|
|
28
|
-
}
|
|
16
|
+
const httpBookedSizeReplaceableProductVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
17
|
+
const response = await httpPost({
|
|
18
|
+
endpoint: "/view-booked-size-replaceable-product-variants-for-checkout-item",
|
|
19
|
+
body: { checkout_item_id: checkoutItemId },
|
|
20
|
+
signal,
|
|
21
|
+
});
|
|
22
|
+
return response.status === 404
|
|
23
|
+
? undefined
|
|
24
|
+
: toBookedSizeReplaceableProductVariants((await response.json()).result);
|
|
29
25
|
};
|
|
30
26
|
export { toBookedSizeReplaceableProductVariants, httpBookedSizeReplaceableProductVariantsForCheckoutItemView, };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { toCheckoutProjection } from "./checkout";
|
|
2
|
-
const httpCheckoutByIdView = ({ httpPost }) => async ({ checkoutId }) => {
|
|
2
|
+
const httpCheckoutByIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
|
|
3
3
|
const response = await httpPost({
|
|
4
4
|
endpoint: "/view-checkout-by-id",
|
|
5
5
|
body: { checkout_id: checkoutId },
|
|
6
|
+
signal,
|
|
6
7
|
});
|
|
7
8
|
return !response.ok || response.status === 404 ? undefined : toCheckoutProjection((await response.json()).result);
|
|
8
9
|
};
|
package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { toCheckoutProjection } from "./checkout";
|
|
2
|
-
const httpFirstAvailableCheckoutByCustomerIdView = ({ httpPost }) => async ({ customerId }) => {
|
|
2
|
+
const httpFirstAvailableCheckoutByCustomerIdView = ({ httpPost }) => async ({ customerId, signal }) => {
|
|
3
3
|
const response = await httpPost({
|
|
4
4
|
endpoint: "/view-first-available-checkout-by-customer-id",
|
|
5
5
|
body: { customer_id: customerId },
|
|
6
|
+
signal,
|
|
6
7
|
});
|
|
7
8
|
return !response.ok || response.status === 404 ? undefined : toCheckoutProjection((await response.json()).result);
|
|
8
9
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const httpFiveItemsDiscountByCustomerIdView = ({ httpGet }) => async ({ customerId }) => {
|
|
1
|
+
const httpFiveItemsDiscountByCustomerIdView = ({ httpGet }) => async ({ customerId, signal }) => {
|
|
2
2
|
const response = await httpGet({
|
|
3
3
|
endpoint: `/view-five-items-discount-by-customer-id/${customerId}`,
|
|
4
|
+
signal,
|
|
4
5
|
});
|
|
5
6
|
return !response.ok ? 0 : await response.json();
|
|
6
7
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const httpIsCheckoutEnabledByCustomerIdView = ({ httpGet }) => async ({ customerId }) => {
|
|
1
|
+
const httpIsCheckoutEnabledByCustomerIdView = ({ httpGet }) => async ({ customerId, signal }) => {
|
|
2
2
|
const response = await httpGet({
|
|
3
3
|
endpoint: `/is-new-checkout-enabled/${customerId}`,
|
|
4
|
+
signal,
|
|
4
5
|
});
|
|
5
6
|
return !response.ok ? false : await response.json();
|
|
6
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
1
|
+
import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
2
|
interface SizeFormat {
|
|
3
3
|
readonly format: string;
|
|
4
4
|
readonly length?: string;
|
|
@@ -30,7 +30,7 @@ interface ViewBookedSizeReplaceableProductVariantsForCheckoutItemFunction {
|
|
|
30
30
|
}
|
|
31
31
|
declare const viewBookedSizeReplaceableProductVariantsForCheckoutItem: ViewBookedSizeReplaceableProductVariantsForCheckoutItemFunction;
|
|
32
32
|
declare type ViewBookedSizeReplaceableProductVariantsForCheckoutItemResult = BookedSizeReplaceableProductVariantsProjection | undefined;
|
|
33
|
-
interface BookedSizeReplaceableProductVariantsForCheckoutItemViewArgs {
|
|
33
|
+
interface BookedSizeReplaceableProductVariantsForCheckoutItemViewArgs extends CancelableQueryViewArgs {
|
|
34
34
|
readonly checkoutItemId: string;
|
|
35
35
|
}
|
|
36
36
|
interface BookedSizeReplaceableProductVariantsForCheckoutItemView {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { query } from "@lookiero/messaging";
|
|
1
|
+
import { query, } from "@lookiero/messaging";
|
|
2
2
|
const VIEW_BOOKED_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "view_booked_size_replaceable_product_variants_for_checkout_item";
|
|
3
3
|
const viewBookedSizeReplaceableProductVariantsForCheckoutItem = (payload) => ({
|
|
4
4
|
...query({ name: VIEW_BOOKED_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM }),
|
|
5
5
|
...payload,
|
|
6
6
|
});
|
|
7
|
-
const viewBookedSizeReplaceableProductVariantsForCheckoutItemHandler = ({ view }) => async ({ checkoutItemId }) => view({ checkoutItemId });
|
|
7
|
+
const viewBookedSizeReplaceableProductVariantsForCheckoutItemHandler = ({ view, signal }) => async ({ checkoutItemId }) => view({ checkoutItemId, signal });
|
|
8
8
|
export { VIEW_BOOKED_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedSizeReplaceableProductVariantsForCheckoutItem, viewBookedSizeReplaceableProductVariantsForCheckoutItemHandler, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
1
|
+
import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
2
|
import { CheckoutProjection } from "./checkout";
|
|
3
3
|
declare const VIEW_CHECKOUT_BY_ID = "view_checkout_by_id";
|
|
4
4
|
interface ViewCheckoutByIdPayload {
|
|
@@ -11,7 +11,7 @@ interface ViewCheckoutByIdFunction {
|
|
|
11
11
|
}
|
|
12
12
|
declare const viewCheckoutById: ViewCheckoutByIdFunction;
|
|
13
13
|
declare type ViewCheckoutByIdResult = CheckoutProjection | undefined;
|
|
14
|
-
interface CheckoutByIdViewArgs {
|
|
14
|
+
interface CheckoutByIdViewArgs extends CancelableQueryViewArgs {
|
|
15
15
|
readonly checkoutId: string;
|
|
16
16
|
}
|
|
17
17
|
interface CheckoutByIdView {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { query } from "@lookiero/messaging";
|
|
1
|
+
import { query, } from "@lookiero/messaging";
|
|
2
2
|
const VIEW_CHECKOUT_BY_ID = "view_checkout_by_id";
|
|
3
3
|
const viewCheckoutById = (payload) => ({
|
|
4
4
|
...query({ name: VIEW_CHECKOUT_BY_ID }),
|
|
5
5
|
...payload,
|
|
6
6
|
});
|
|
7
|
-
const viewCheckoutByIdHandler = ({ view }) => async ({ checkoutId }) => view({ checkoutId });
|
|
7
|
+
const viewCheckoutByIdHandler = ({ view, signal }) => async ({ checkoutId }) => view({ checkoutId, signal });
|
|
8
8
|
export { VIEW_CHECKOUT_BY_ID, viewCheckoutById, viewCheckoutByIdHandler };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
1
|
+
import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
2
|
import { CheckoutProjection } from "./checkout";
|
|
3
3
|
declare const VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID = "view_first_available_checkout_by_customer_id";
|
|
4
4
|
interface ViewFirstAvailableCheckoutByCustomerIdPayload {
|
|
@@ -11,7 +11,7 @@ interface ViewFirstAvailableCheckoutByCustomerIdFunction {
|
|
|
11
11
|
}
|
|
12
12
|
declare const viewFirstAvailableCheckoutByCustomerId: ViewFirstAvailableCheckoutByCustomerIdFunction;
|
|
13
13
|
declare type ViewFirstAvailableCheckoutByCustomerIdResult = CheckoutProjection | undefined;
|
|
14
|
-
interface FirstAvailableCheckoutByCustomerIdViewArgs {
|
|
14
|
+
interface FirstAvailableCheckoutByCustomerIdViewArgs extends CancelableQueryViewArgs {
|
|
15
15
|
readonly customerId: string;
|
|
16
16
|
}
|
|
17
17
|
interface FirstAvailableCheckoutByCustomerIdView {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { query } from "@lookiero/messaging";
|
|
1
|
+
import { query, } from "@lookiero/messaging";
|
|
2
2
|
const VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID = "view_first_available_checkout_by_customer_id";
|
|
3
3
|
const viewFirstAvailableCheckoutByCustomerId = (payload) => ({
|
|
4
4
|
...query({ name: VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID }),
|
|
5
5
|
...payload,
|
|
6
6
|
});
|
|
7
|
-
const viewFirstAvailableCheckoutByCustomerIdHandler = ({ view }) => async ({ customerId }) => view({ customerId });
|
|
7
|
+
const viewFirstAvailableCheckoutByCustomerIdHandler = ({ view, signal }) => async ({ customerId }) => view({ customerId, signal });
|
|
8
8
|
export { VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerId, viewFirstAvailableCheckoutByCustomerIdHandler, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
1
|
+
import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
2
|
declare type FiveItemsDiscountByCustomerIdProjection = number;
|
|
3
3
|
declare const VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID = "view_five_items_discount_by_customer_id";
|
|
4
4
|
interface ViewFiveItemsDiscountByCustomerIdPayload {
|
|
@@ -10,7 +10,7 @@ interface ViewFiveItemsDiscountByCustomerIdFunction {
|
|
|
10
10
|
(payload: ViewFiveItemsDiscountByCustomerIdPayload): ViewFiveItemsDiscountByCustomerId;
|
|
11
11
|
}
|
|
12
12
|
declare const viewFiveItemsDiscountByCustomerId: ViewFiveItemsDiscountByCustomerIdFunction;
|
|
13
|
-
interface FiveItemsDiscountByCustomerIdViewArgs {
|
|
13
|
+
interface FiveItemsDiscountByCustomerIdViewArgs extends CancelableQueryViewArgs {
|
|
14
14
|
readonly customerId: string;
|
|
15
15
|
}
|
|
16
16
|
interface FiveItemsDiscountByCustomerIdView {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { query } from "@lookiero/messaging";
|
|
1
|
+
import { query, } from "@lookiero/messaging";
|
|
2
2
|
const VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID = "view_five_items_discount_by_customer_id";
|
|
3
3
|
const viewFiveItemsDiscountByCustomerId = (payload) => ({
|
|
4
4
|
...query({ name: VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID }),
|
|
5
5
|
...payload,
|
|
6
6
|
});
|
|
7
|
-
const viewFiveItemsDiscountByCustomerIdHandler = ({ view }) => async ({ customerId }) => view({ customerId });
|
|
7
|
+
const viewFiveItemsDiscountByCustomerIdHandler = ({ view, signal }) => async ({ customerId }) => view({ customerId, signal });
|
|
8
8
|
export { VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, viewFiveItemsDiscountByCustomerId, viewFiveItemsDiscountByCustomerIdHandler, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
1
|
+
import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
2
|
declare type IsCheckoutEnabledByCustomerIdProjection = boolean;
|
|
3
3
|
declare const VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID = "view_is_checkout_enabled_by_customer_id";
|
|
4
4
|
interface ViewIsCheckoutEnabledByCustomerIdPayload {
|
|
@@ -10,7 +10,7 @@ interface ViewIsCheckoutEnabledByCustomerIdFunction {
|
|
|
10
10
|
(payload: ViewIsCheckoutEnabledByCustomerIdPayload): ViewIsCheckoutEnabledByCustomerId;
|
|
11
11
|
}
|
|
12
12
|
declare const viewIsCheckoutEnabledByCustomerId: ViewIsCheckoutEnabledByCustomerIdFunction;
|
|
13
|
-
interface IsCheckoutEnabledByCustomerIdViewArgs {
|
|
13
|
+
interface IsCheckoutEnabledByCustomerIdViewArgs extends CancelableQueryViewArgs {
|
|
14
14
|
readonly customerId: string;
|
|
15
15
|
}
|
|
16
16
|
interface IsCheckoutEnabledByCustomerIdView {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { query } from "@lookiero/messaging";
|
|
1
|
+
import { query, } from "@lookiero/messaging";
|
|
2
2
|
const VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID = "view_is_checkout_enabled_by_customer_id";
|
|
3
3
|
const viewIsCheckoutEnabledByCustomerId = (payload) => ({
|
|
4
4
|
...query({ name: VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID }),
|
|
5
5
|
...payload,
|
|
6
6
|
});
|
|
7
|
-
const viewIsCheckoutEnabledByCustomerIdHandler = ({ view }) => async ({ customerId }) => view({ customerId });
|
|
7
|
+
const viewIsCheckoutEnabledByCustomerIdHandler = ({ view, signal }) => async ({ customerId }) => view({ customerId, signal });
|
|
8
8
|
export { VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, viewIsCheckoutEnabledByCustomerId, viewIsCheckoutEnabledByCustomerIdHandler, };
|
package/package.json
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": "
|
|
10
|
+
"node": "^14.20.0 | ^18.9.0"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
|
+
"type-check": "tsc --project ./tsconfig.json --noemit --incremental",
|
|
13
14
|
"start": "expo start",
|
|
14
15
|
"android": "expo start --android",
|
|
15
16
|
"ios": "expo start --ios",
|
|
16
17
|
"web": "expo start --web",
|
|
17
|
-
"export-analyze-web": "expo export:web",
|
|
18
|
+
"export-analyze-web": "BUNDLE_ANALYZE=true NODE_ENV=production expo export:web",
|
|
18
19
|
"build": "tsc -b tsconfig.build.json",
|
|
20
|
+
"build:app": "npm run type-check && ENTRY_POINT='./src/Expo.tsx' NODE_ENV=production expo export:web --clear",
|
|
19
21
|
"lint": "eslint --fix --cache --cache-location ./node_modules/.cache/.eslintcache --ext ts,tsx .",
|
|
20
22
|
"format": "prettier --write \"**/*.+(json|css|ts|tsx|md)\"",
|
|
21
23
|
"test": "jest",
|
|
22
24
|
"test:coverage": "jest --coverage --coverageReporters=text --detectOpenHandles --forceExit --silent"
|
|
23
25
|
},
|
|
24
26
|
"dependencies": {
|
|
25
|
-
"@lookiero/i18n": "^0.
|
|
26
|
-
"@lookiero/i18n-react": "^0.
|
|
27
|
-
"@lookiero/messaging": "^
|
|
28
|
-
"@lookiero/messaging-react": "^
|
|
27
|
+
"@lookiero/i18n": "^0.8.0",
|
|
28
|
+
"@lookiero/i18n-react": "^0.8.0",
|
|
29
|
+
"@lookiero/messaging": "^8.0.0",
|
|
30
|
+
"@lookiero/messaging-react": "^8.0.0",
|
|
29
31
|
"react-native-get-random-values": "^1.8.0",
|
|
30
32
|
"react-router-dom": "^6.3.0",
|
|
31
33
|
"react-router-native": "^6.3.0",
|