@wix/headless-restaurants-olo 0.0.9 → 0.0.10
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/cjs/dist/services/item-details-service.d.ts +3 -2
- package/cjs/dist/services/item-details-service.js +3 -8
- package/cjs/dist/services/olo-settings-service.d.ts +0 -3
- package/cjs/dist/services/olo-settings-service.js +0 -8
- package/dist/services/item-details-service.d.ts +3 -2
- package/dist/services/item-details-service.js +3 -8
- package/dist/services/olo-settings-service.d.ts +0 -3
- package/dist/services/olo-settings-service.js +0 -8
- package/package.json +1 -1
|
@@ -56,7 +56,7 @@ export interface ItemServiceConfig {
|
|
|
56
56
|
item?: EnhancedItem;
|
|
57
57
|
itemId?: string;
|
|
58
58
|
operationId?: string;
|
|
59
|
-
|
|
59
|
+
availabilityStatus?: AvailabilityStatus;
|
|
60
60
|
}
|
|
61
61
|
export declare const ItemService: import("@wix/services-definitions").ServiceFactory<string & {
|
|
62
62
|
__api: ItemServiceAPI;
|
|
@@ -161,8 +161,9 @@ export interface NotFoundItemServiceConfigResult {
|
|
|
161
161
|
* }
|
|
162
162
|
* ```
|
|
163
163
|
*/
|
|
164
|
-
export declare function loadItemServiceConfig({ item, operationId, }: {
|
|
164
|
+
export declare function loadItemServiceConfig({ item, operationId, availabilityStatus, }: {
|
|
165
165
|
item: EnhancedItem;
|
|
166
166
|
operationId: string;
|
|
167
|
+
availabilityStatus?: AvailabilityStatus;
|
|
167
168
|
}): ItemServiceConfig;
|
|
168
169
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineService, implementService } from '@wix/services-definitions';
|
|
2
2
|
import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
|
|
3
|
-
import { OLOSettingsServiceDefinition } from './olo-settings-service.js';
|
|
4
3
|
import { AvailabilityStatus } from './common-types.js';
|
|
5
4
|
import { getModifiersInitState } from './utils.js';
|
|
6
5
|
/**
|
|
@@ -46,11 +45,7 @@ export const ItemServiceDefinition = defineService('item');
|
|
|
46
45
|
const APP_ID = '9a5d83fd-8570-482e-81ab-cfa88942ee60';
|
|
47
46
|
export const ItemService = implementService.withConfig()(ItemServiceDefinition, ({ getService, config }) => {
|
|
48
47
|
const signalsService = getService(SignalsServiceDefinition);
|
|
49
|
-
const
|
|
50
|
-
const getAvailabilityStatusFn = oloSettingsService.getAvailabilityStatus?.get?.();
|
|
51
|
-
const initialAvailabilityStatus = getAvailabilityStatusFn?.(config.menuId ?? '') ??
|
|
52
|
-
AvailabilityStatus.AVAILABLE;
|
|
53
|
-
const availabilityStatus = signalsService.signal(initialAvailabilityStatus);
|
|
48
|
+
const availabilityStatus = signalsService.signal(config.availabilityStatus ?? AvailabilityStatus.AVAILABLE);
|
|
54
49
|
const item = signalsService.signal(config.item);
|
|
55
50
|
const isLoading = signalsService.signal(!!config.item);
|
|
56
51
|
const error = signalsService.signal(config.item ? null : 'Item not found');
|
|
@@ -233,8 +228,8 @@ export const ItemService = implementService.withConfig()(ItemServiceDefinition,
|
|
|
233
228
|
* }
|
|
234
229
|
* ```
|
|
235
230
|
*/
|
|
236
|
-
export function loadItemServiceConfig({ item, operationId, }) {
|
|
237
|
-
return { item, operationId };
|
|
231
|
+
export function loadItemServiceConfig({ item, operationId, availabilityStatus = AvailabilityStatus.AVAILABLE, }) {
|
|
232
|
+
return { item, operationId, availabilityStatus };
|
|
238
233
|
}
|
|
239
234
|
// try {
|
|
240
235
|
// if (item === null) {
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import * as operationGroupsApi from '@wix/auto_sdk_restaurants_operation-groups';
|
|
2
2
|
import * as operationsApi from '@wix/auto_sdk_restaurants_operations';
|
|
3
3
|
import { type Signal } from '@wix/services-definitions/core-services/signals';
|
|
4
|
-
import { AvailabilityStatus } from './common-types.js';
|
|
5
4
|
export interface OLOSettingsServiceAPI {
|
|
6
5
|
operationGroup: Signal<operationGroupsApi.OperationGroup | undefined>;
|
|
7
6
|
operation: Signal<operationsApi.Operation | undefined>;
|
|
8
7
|
selectedItem?: Signal<unknown>;
|
|
9
8
|
isLoading: Signal<boolean>;
|
|
10
9
|
error: Signal<string | null>;
|
|
11
|
-
getAvailabilityStatus: Signal<(menuId: string) => AvailabilityStatus>;
|
|
12
10
|
availabilityDispatchAction?: Signal<(() => void) | undefined>;
|
|
13
11
|
}
|
|
14
12
|
export interface OLOSettingsServiceConfig {
|
|
15
13
|
operationGroup?: operationGroupsApi.OperationGroup;
|
|
16
14
|
operation?: operationsApi.Operation;
|
|
17
|
-
availabilityStatusMenuMap: Record<string, AvailabilityStatus>;
|
|
18
15
|
availabilityDispatchAction?: () => void;
|
|
19
16
|
}
|
|
20
17
|
export declare const OLOSettingsServiceDefinition: string & {
|
|
@@ -2,29 +2,21 @@ import { defineService, implementService } from '@wix/services-definitions';
|
|
|
2
2
|
import * as operationGroupsApi from '@wix/auto_sdk_restaurants_operation-groups';
|
|
3
3
|
import * as operationsApi from '@wix/auto_sdk_restaurants_operations';
|
|
4
4
|
import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
|
|
5
|
-
import { AvailabilityStatus } from './common-types.js';
|
|
6
5
|
export const OLOSettingsServiceDefinition = defineService('oloSettings');
|
|
7
6
|
export const OLOSettingsService = implementService.withConfig()(OLOSettingsServiceDefinition, ({ getService, config }) => {
|
|
8
7
|
const signalsService = getService(SignalsServiceDefinition);
|
|
9
|
-
const availabilityStatusMenuMap = signalsService.signal(config.availabilityStatusMenuMap);
|
|
10
8
|
const availabilityDispatchAction = signalsService.signal(config.availabilityDispatchAction);
|
|
11
9
|
const operationGroup = signalsService.signal(config.operationGroup);
|
|
12
10
|
const operation = signalsService.signal(config.operation);
|
|
13
11
|
const selectedItem = signalsService.signal(null);
|
|
14
12
|
const isLoading = signalsService.signal(false);
|
|
15
13
|
const error = signalsService.signal(null);
|
|
16
|
-
const getAvailabilityStatusFn = (menuId) => {
|
|
17
|
-
return (availabilityStatusMenuMap.get()?.[menuId] ??
|
|
18
|
-
AvailabilityStatus.AVAILABLE);
|
|
19
|
-
};
|
|
20
|
-
const getAvailabilityStatus = signalsService.signal(getAvailabilityStatusFn);
|
|
21
14
|
return {
|
|
22
15
|
operationGroup,
|
|
23
16
|
operation,
|
|
24
17
|
isLoading,
|
|
25
18
|
error,
|
|
26
19
|
selectedItem,
|
|
27
|
-
getAvailabilityStatus,
|
|
28
20
|
availabilityDispatchAction,
|
|
29
21
|
};
|
|
30
22
|
});
|
|
@@ -56,7 +56,7 @@ export interface ItemServiceConfig {
|
|
|
56
56
|
item?: EnhancedItem;
|
|
57
57
|
itemId?: string;
|
|
58
58
|
operationId?: string;
|
|
59
|
-
|
|
59
|
+
availabilityStatus?: AvailabilityStatus;
|
|
60
60
|
}
|
|
61
61
|
export declare const ItemService: import("@wix/services-definitions").ServiceFactory<string & {
|
|
62
62
|
__api: ItemServiceAPI;
|
|
@@ -161,8 +161,9 @@ export interface NotFoundItemServiceConfigResult {
|
|
|
161
161
|
* }
|
|
162
162
|
* ```
|
|
163
163
|
*/
|
|
164
|
-
export declare function loadItemServiceConfig({ item, operationId, }: {
|
|
164
|
+
export declare function loadItemServiceConfig({ item, operationId, availabilityStatus, }: {
|
|
165
165
|
item: EnhancedItem;
|
|
166
166
|
operationId: string;
|
|
167
|
+
availabilityStatus?: AvailabilityStatus;
|
|
167
168
|
}): ItemServiceConfig;
|
|
168
169
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineService, implementService } from '@wix/services-definitions';
|
|
2
2
|
import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
|
|
3
|
-
import { OLOSettingsServiceDefinition } from './olo-settings-service.js';
|
|
4
3
|
import { AvailabilityStatus } from './common-types.js';
|
|
5
4
|
import { getModifiersInitState } from './utils.js';
|
|
6
5
|
/**
|
|
@@ -46,11 +45,7 @@ export const ItemServiceDefinition = defineService('item');
|
|
|
46
45
|
const APP_ID = '9a5d83fd-8570-482e-81ab-cfa88942ee60';
|
|
47
46
|
export const ItemService = implementService.withConfig()(ItemServiceDefinition, ({ getService, config }) => {
|
|
48
47
|
const signalsService = getService(SignalsServiceDefinition);
|
|
49
|
-
const
|
|
50
|
-
const getAvailabilityStatusFn = oloSettingsService.getAvailabilityStatus?.get?.();
|
|
51
|
-
const initialAvailabilityStatus = getAvailabilityStatusFn?.(config.menuId ?? '') ??
|
|
52
|
-
AvailabilityStatus.AVAILABLE;
|
|
53
|
-
const availabilityStatus = signalsService.signal(initialAvailabilityStatus);
|
|
48
|
+
const availabilityStatus = signalsService.signal(config.availabilityStatus ?? AvailabilityStatus.AVAILABLE);
|
|
54
49
|
const item = signalsService.signal(config.item);
|
|
55
50
|
const isLoading = signalsService.signal(!!config.item);
|
|
56
51
|
const error = signalsService.signal(config.item ? null : 'Item not found');
|
|
@@ -233,8 +228,8 @@ export const ItemService = implementService.withConfig()(ItemServiceDefinition,
|
|
|
233
228
|
* }
|
|
234
229
|
* ```
|
|
235
230
|
*/
|
|
236
|
-
export function loadItemServiceConfig({ item, operationId, }) {
|
|
237
|
-
return { item, operationId };
|
|
231
|
+
export function loadItemServiceConfig({ item, operationId, availabilityStatus = AvailabilityStatus.AVAILABLE, }) {
|
|
232
|
+
return { item, operationId, availabilityStatus };
|
|
238
233
|
}
|
|
239
234
|
// try {
|
|
240
235
|
// if (item === null) {
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import * as operationGroupsApi from '@wix/auto_sdk_restaurants_operation-groups';
|
|
2
2
|
import * as operationsApi from '@wix/auto_sdk_restaurants_operations';
|
|
3
3
|
import { type Signal } from '@wix/services-definitions/core-services/signals';
|
|
4
|
-
import { AvailabilityStatus } from './common-types.js';
|
|
5
4
|
export interface OLOSettingsServiceAPI {
|
|
6
5
|
operationGroup: Signal<operationGroupsApi.OperationGroup | undefined>;
|
|
7
6
|
operation: Signal<operationsApi.Operation | undefined>;
|
|
8
7
|
selectedItem?: Signal<unknown>;
|
|
9
8
|
isLoading: Signal<boolean>;
|
|
10
9
|
error: Signal<string | null>;
|
|
11
|
-
getAvailabilityStatus: Signal<(menuId: string) => AvailabilityStatus>;
|
|
12
10
|
availabilityDispatchAction?: Signal<(() => void) | undefined>;
|
|
13
11
|
}
|
|
14
12
|
export interface OLOSettingsServiceConfig {
|
|
15
13
|
operationGroup?: operationGroupsApi.OperationGroup;
|
|
16
14
|
operation?: operationsApi.Operation;
|
|
17
|
-
availabilityStatusMenuMap: Record<string, AvailabilityStatus>;
|
|
18
15
|
availabilityDispatchAction?: () => void;
|
|
19
16
|
}
|
|
20
17
|
export declare const OLOSettingsServiceDefinition: string & {
|
|
@@ -2,29 +2,21 @@ import { defineService, implementService } from '@wix/services-definitions';
|
|
|
2
2
|
import * as operationGroupsApi from '@wix/auto_sdk_restaurants_operation-groups';
|
|
3
3
|
import * as operationsApi from '@wix/auto_sdk_restaurants_operations';
|
|
4
4
|
import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
|
|
5
|
-
import { AvailabilityStatus } from './common-types.js';
|
|
6
5
|
export const OLOSettingsServiceDefinition = defineService('oloSettings');
|
|
7
6
|
export const OLOSettingsService = implementService.withConfig()(OLOSettingsServiceDefinition, ({ getService, config }) => {
|
|
8
7
|
const signalsService = getService(SignalsServiceDefinition);
|
|
9
|
-
const availabilityStatusMenuMap = signalsService.signal(config.availabilityStatusMenuMap);
|
|
10
8
|
const availabilityDispatchAction = signalsService.signal(config.availabilityDispatchAction);
|
|
11
9
|
const operationGroup = signalsService.signal(config.operationGroup);
|
|
12
10
|
const operation = signalsService.signal(config.operation);
|
|
13
11
|
const selectedItem = signalsService.signal(null);
|
|
14
12
|
const isLoading = signalsService.signal(false);
|
|
15
13
|
const error = signalsService.signal(null);
|
|
16
|
-
const getAvailabilityStatusFn = (menuId) => {
|
|
17
|
-
return (availabilityStatusMenuMap.get()?.[menuId] ??
|
|
18
|
-
AvailabilityStatus.AVAILABLE);
|
|
19
|
-
};
|
|
20
|
-
const getAvailabilityStatus = signalsService.signal(getAvailabilityStatusFn);
|
|
21
14
|
return {
|
|
22
15
|
operationGroup,
|
|
23
16
|
operation,
|
|
24
17
|
isLoading,
|
|
25
18
|
error,
|
|
26
19
|
selectedItem,
|
|
27
|
-
getAvailabilityStatus,
|
|
28
20
|
availabilityDispatchAction,
|
|
29
21
|
};
|
|
30
22
|
});
|