@wix/headless-restaurants-olo 0.0.24 → 0.0.26
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/react/ItemDetails.d.ts +2 -2
- package/cjs/dist/react/ItemDetails.js +1 -9
- package/cjs/dist/react/OLO.d.ts +0 -2
- package/cjs/dist/react/OLO.js +6 -6
- package/cjs/dist/react/Settings.d.ts +24 -21
- package/cjs/dist/react/Settings.js +34 -4
- package/cjs/dist/react/core/OLO.d.ts +0 -1
- package/cjs/dist/react/core/OLO.js +2 -79
- package/cjs/dist/react/core/Settings.d.ts +41 -65
- package/cjs/dist/react/core/Settings.js +83 -113
- package/cjs/dist/services/fulfillments-service.js +22 -18
- package/cjs/dist/types/fulfillments-types.d.ts +7 -4
- package/dist/react/ItemDetails.d.ts +2 -2
- package/dist/react/ItemDetails.js +1 -9
- package/dist/react/OLO.d.ts +0 -2
- package/dist/react/OLO.js +6 -6
- package/dist/react/Settings.d.ts +24 -21
- package/dist/react/Settings.js +34 -4
- package/dist/react/core/OLO.d.ts +0 -1
- package/dist/react/core/OLO.js +2 -79
- package/dist/react/core/Settings.d.ts +41 -65
- package/dist/react/core/Settings.js +83 -113
- package/dist/services/fulfillments-service.js +22 -18
- package/dist/types/fulfillments-types.d.ts +7 -4
- package/package.json +2 -2
|
@@ -99,7 +99,7 @@ export interface AddToCartButtonProps {
|
|
|
99
99
|
asChild?: boolean;
|
|
100
100
|
className?: string;
|
|
101
101
|
addToCartLabelMap: Record<AddToCartButtonState, string>;
|
|
102
|
-
children
|
|
102
|
+
children?: AsChildChildren<{
|
|
103
103
|
lineItem: LineItem;
|
|
104
104
|
buttonState: AddToCartButtonState;
|
|
105
105
|
addToCartButtonDisabled?: boolean;
|
|
@@ -109,7 +109,7 @@ export interface AddToCartButtonProps {
|
|
|
109
109
|
label: React.ReactNode;
|
|
110
110
|
formattedPrice: string;
|
|
111
111
|
modifierGroupHasError: boolean;
|
|
112
|
-
}
|
|
112
|
+
}>;
|
|
113
113
|
}
|
|
114
114
|
export declare const AddToCartButton: React.ForwardRefExoticComponent<AddToCartButtonProps & React.RefAttributes<HTMLElement>>;
|
|
115
115
|
export interface ItemDetailsQuantityProps {
|
|
@@ -50,15 +50,7 @@ export const AddToCartButton = React.forwardRef(({ asChild, children, className,
|
|
|
50
50
|
label,
|
|
51
51
|
formattedPrice,
|
|
52
52
|
modifierGroupHasError,
|
|
53
|
-
}, ref: ref, ...props, children: _jsx(Commerce.Actions.AddToCart, { asChild: false, label: label, className: className, lineItems: [lineItem], ...props
|
|
54
|
-
lineItem,
|
|
55
|
-
buttonState,
|
|
56
|
-
addToCartButtonDisabled,
|
|
57
|
-
loadingState,
|
|
58
|
-
label,
|
|
59
|
-
formattedPrice,
|
|
60
|
-
modifierGroupHasError,
|
|
61
|
-
}) }) }));
|
|
53
|
+
}, ref: ref, ...props, children: _jsx(Commerce.Actions.AddToCart, { asChild: false, label: label, className: className, lineItems: [lineItem], ...props }) }));
|
|
62
54
|
} }));
|
|
63
55
|
});
|
|
64
56
|
AddToCartButton.displayName = 'AddToCartButton';
|
package/cjs/dist/react/OLO.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { ItemServiceConfig } from '../services/item-details-service.js';
|
|
3
3
|
import { OLOSettingsServiceConfig } from '../services/olo-settings-service.js';
|
|
4
4
|
interface OLORootProps {
|
|
5
|
-
/** The ID of the item to load */
|
|
6
|
-
itemId?: string;
|
|
7
5
|
/** Pre-loaded item service config (optional) */
|
|
8
6
|
itemServiceConfig?: ItemServiceConfig;
|
|
9
7
|
/** Pre-loaded OLO settings service config (optional) */
|
package/cjs/dist/react/OLO.js
CHANGED
|
@@ -20,12 +20,12 @@ import { CoreOLO } from './core/index.js';
|
|
|
20
20
|
* </OLO.Root>
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
export const Root = ({
|
|
23
|
+
export const Root = ({ oloSettingsServiceConfig, children, }) => {
|
|
24
24
|
const [retryKey] = React.useState(0);
|
|
25
25
|
// const retry = React.useCallback(() => {
|
|
26
26
|
// setRetryKey(prev => prev + 1);
|
|
27
27
|
// }, []);
|
|
28
|
-
return (_jsx(CoreOLO.Root, {
|
|
28
|
+
return (_jsx(CoreOLO.Root, { oloSettingsServiceConfig: oloSettingsServiceConfig, children: children }, retryKey));
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* Convenience provider that handles loading and error states automatically
|
|
@@ -41,7 +41,7 @@ export const Root = ({ itemId, oloSettingsServiceConfig, children, }) => {
|
|
|
41
41
|
* </OLO.Provider>
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
|
-
export const Provider = ({
|
|
44
|
+
export const Provider = ({ configs,
|
|
45
45
|
// loading = (
|
|
46
46
|
// <div className="flex items-center justify-center p-8">
|
|
47
47
|
// <div className="text-secondary-foreground">Loading services...</div>
|
|
@@ -59,7 +59,7 @@ export const Provider = ({ itemId, configs,
|
|
|
59
59
|
// </div>
|
|
60
60
|
// ),
|
|
61
61
|
children, }) => {
|
|
62
|
-
return
|
|
62
|
+
return _jsx(Root, { itemServiceConfig: configs?.itemServiceConfig, children: children });
|
|
63
63
|
};
|
|
64
64
|
/**
|
|
65
65
|
* Specialized headless component for item details
|
|
@@ -120,8 +120,8 @@ export const Cart = ({ loading, error, children }) => {
|
|
|
120
120
|
* </OLO.ServicesStatus>
|
|
121
121
|
* ```
|
|
122
122
|
*/
|
|
123
|
-
export const ServicesStatus = ({
|
|
124
|
-
return (_jsx(Root, {
|
|
123
|
+
export const ServicesStatus = ({ children, }) => {
|
|
124
|
+
return (_jsx(Root, { children: children }));
|
|
125
125
|
};
|
|
126
126
|
export const Menus = ({
|
|
127
127
|
// menuServiceConfig,
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { FulfillmentsServiceConfig } from '../types/fulfillments-types.js';
|
|
2
3
|
import { AsChildChildren } from '@wix/headless-utils/react';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the Settings Root component
|
|
6
|
+
*/
|
|
7
|
+
export interface RootProps {
|
|
8
|
+
/** Child components that will have access to the settings context */
|
|
9
|
+
children: (props: {
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
}) => React.ReactNode;
|
|
12
|
+
/** Optional pre-loaded fulfillments service configuration */
|
|
13
|
+
fulfillmentsServiceConfig?: FulfillmentsServiceConfig;
|
|
14
|
+
}
|
|
3
15
|
/**
|
|
4
16
|
* Root headless component for OLO Settings
|
|
5
|
-
* Provides
|
|
17
|
+
* Provides service context for settings components
|
|
6
18
|
*
|
|
7
19
|
* @example
|
|
8
20
|
* ```tsx
|
|
9
|
-
* <Settings.Root>
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* <div>
|
|
13
|
-
* )
|
|
14
|
-
*
|
|
15
|
-
* ) : (
|
|
16
|
-
* <div>
|
|
17
|
-
* <h2>{currentDetails.name}</h2>
|
|
18
|
-
* <p>{currentDetails.address}</p>
|
|
19
|
-
* <p>Accepting Orders: {extraData.acceptingOrders ? 'Yes' : 'No'}</p>
|
|
20
|
-
* <p>Delivery Fee: ${extraData.deliveryFee}</p>
|
|
21
|
-
* <p>Min Order: ${extraData.minOrderAmount}</p>
|
|
22
|
-
* <p>Free Delivery: ${extraData.freeDeliveryThreshold}</p>
|
|
23
|
-
* </div>
|
|
24
|
-
* )
|
|
25
|
-
* )}
|
|
21
|
+
* <Settings.Root fulfillmentsServiceConfig={config}>
|
|
22
|
+
* <Settings.CurrentTimeSlot>
|
|
23
|
+
* {({ timeSlot, hasDetails }) => (
|
|
24
|
+
* <div>{timeSlot?.dispatchType}</div>
|
|
25
|
+
* )}
|
|
26
|
+
* </Settings.CurrentTimeSlot>
|
|
26
27
|
* </Settings.Root>
|
|
27
28
|
* ```
|
|
28
29
|
*/
|
|
30
|
+
export declare const Root: React.FC<RootProps>;
|
|
29
31
|
interface CurrentTimeSlotProps {
|
|
30
32
|
/** Children render prop that receives the current details */
|
|
31
33
|
children?: AsChildChildren<{
|
|
@@ -114,9 +116,10 @@ interface CurrentLocationProps {
|
|
|
114
116
|
* ```
|
|
115
117
|
*/
|
|
116
118
|
export declare const CurrentLocation: React.FC<CurrentLocationProps>;
|
|
117
|
-
interface ExtraDataProps {
|
|
119
|
+
interface ExtraDataProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
120
|
+
asChild?: boolean;
|
|
118
121
|
/** Children render prop that receives the extra settings data */
|
|
119
|
-
children
|
|
122
|
+
children?: AsChildChildren<{
|
|
120
123
|
extraData: {
|
|
121
124
|
acceptingOrders: boolean;
|
|
122
125
|
deliveryFee?: number;
|
|
@@ -128,7 +131,7 @@ interface ExtraDataProps {
|
|
|
128
131
|
orderingDisabledReason?: string;
|
|
129
132
|
};
|
|
130
133
|
hasExtraData: boolean;
|
|
131
|
-
}
|
|
134
|
+
}> | React.ReactNode;
|
|
132
135
|
}
|
|
133
136
|
/**
|
|
134
137
|
* Headless component for extra settings data
|
|
@@ -1,8 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { CoreSettings } from './core/index.js';
|
|
4
|
-
// import { OLOSettingsServiceConfig } from '../services/olo-settings-service.js';
|
|
5
4
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
5
|
+
// ========================================
|
|
6
|
+
// OLO SETTINGS HEADLESS COMPONENTS
|
|
7
|
+
// ========================================
|
|
8
|
+
// Headless components that wrap CoreSettings and provide convenient service management
|
|
9
|
+
// These components handle service initialization and provide render props for UI
|
|
10
|
+
// ========================================
|
|
11
|
+
// ROOT COMPONENT
|
|
12
|
+
// ========================================
|
|
13
|
+
var TestIds;
|
|
14
|
+
(function (TestIds) {
|
|
15
|
+
TestIds["settingsRoot"] = "settings-root";
|
|
16
|
+
})(TestIds || (TestIds = {}));
|
|
17
|
+
/**
|
|
18
|
+
* Root headless component for OLO Settings
|
|
19
|
+
* Provides service context for settings components
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <Settings.Root fulfillmentsServiceConfig={config}>
|
|
24
|
+
* <Settings.CurrentTimeSlot>
|
|
25
|
+
* {({ timeSlot, hasDetails }) => (
|
|
26
|
+
* <div>{timeSlot?.dispatchType}</div>
|
|
27
|
+
* )}
|
|
28
|
+
* </Settings.CurrentTimeSlot>
|
|
29
|
+
* </Settings.Root>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export const Root = ({ children, fulfillmentsServiceConfig, }) => {
|
|
33
|
+
return (_jsx(CoreSettings.Root, { fulfillmentsServiceConfig: fulfillmentsServiceConfig, "data-testid": TestIds.settingsRoot, children: ({ isLoading }) => children({ isLoading }) }));
|
|
34
|
+
};
|
|
35
|
+
Root.displayName = 'Settings.Root';
|
|
6
36
|
/**
|
|
7
37
|
* Headless component for current store details
|
|
8
38
|
* Provides access to store name, address, contact info, and hours
|
|
@@ -89,6 +119,6 @@ export const CurrentLocation = ({ children, className, asChild, }) => {
|
|
|
89
119
|
* </Settings.ExtraData>
|
|
90
120
|
* ```
|
|
91
121
|
*/
|
|
92
|
-
export const ExtraData = ({ children }) => {
|
|
93
|
-
return _jsx(CoreSettings.ExtraData, { children: children });
|
|
122
|
+
export const ExtraData = ({ children, asChild, className, ...rest }) => {
|
|
123
|
+
return (_jsx(CoreSettings.ExtraData, { children: ({ extraData, hasExtraData }) => (_jsx(AsChildSlot, { asChild: asChild, className: className, customElement: children, customElementProps: { extraData, hasExtraData }, content: hasExtraData ? (_jsx("div", { children: extraData.acceptingOrders ? 'Accepting Orders' : 'Closed' })) : null, ...rest, children: hasExtraData ? (_jsx("div", { children: extraData.acceptingOrders ? 'Accepting Orders' : 'Closed' })) : null })) }));
|
|
94
124
|
};
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { OLOSettingsServiceConfig } from '../../services/olo-settings-service.js';
|
|
3
3
|
import { ItemServiceConfig } from '../../services/item-details-service.js';
|
|
4
4
|
interface CoreOLORootProps {
|
|
5
|
-
/** The ID of the item to load */
|
|
6
5
|
itemId?: string;
|
|
7
6
|
/** Pre-loaded item service config (optional) */
|
|
8
7
|
itemServiceConfig?: ItemServiceConfig;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
2
|
import { createServicesMap } from '@wix/services-manager';
|
|
4
3
|
import { WixServices } from '@wix/services-manager-react';
|
|
5
4
|
// import { ItemService, ItemServiceDefinition, loadItemServiceConfig } from '@/components/restaurants-olo/services/itemDetailsService';
|
|
6
5
|
import { OLOSettingsService, OLOSettingsServiceDefinition, } from '@wix/headless-restaurants-olo/services';
|
|
7
|
-
import { FulfillmentsService, FulfillmentsServiceDefinition, loadFulfillmentsServiceConfig, } from '../../services/fulfillments-service.js';
|
|
8
6
|
/**
|
|
9
7
|
* Core OLO Root component that sets up service management
|
|
10
8
|
* Provides ItemService and CurrentCartService to child components
|
|
@@ -24,83 +22,8 @@ import { FulfillmentsService, FulfillmentsServiceDefinition, loadFulfillmentsSer
|
|
|
24
22
|
* </CoreOLO.Root>
|
|
25
23
|
* ```
|
|
26
24
|
*/
|
|
27
|
-
export const Root = ({
|
|
28
|
-
|
|
29
|
-
operation: oloSettingsServiceConfig?.operation ?? undefined,
|
|
30
|
-
});
|
|
31
|
-
// const [servicesManager, setServicesManager] = useState<ServicesManager | null>(null);
|
|
32
|
-
// const [isLoading, setIsLoading] = useState(true);
|
|
33
|
-
// const [error, setError] = useState<string | undefined>();
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
// const initializeServices = async () => {
|
|
36
|
-
// setIsLoading(true);
|
|
37
|
-
// setError(undefined);
|
|
38
|
-
// try {
|
|
39
|
-
// // Load configurations if not provided
|
|
40
|
-
// const loadedConfigs = await Promise.all([
|
|
41
|
-
// cartServiceConfig || loadCurrentCartServiceConfig(),
|
|
42
|
-
// itemServiceConfig || (loadItemServiceConfig(itemId))
|
|
43
|
-
// ]);
|
|
44
|
-
// const [currentCartServiceConfig, itemServiceConfigResult] = loadedConfigs;
|
|
45
|
-
// // Handle item service config result (discriminated union)
|
|
46
|
-
// if (itemServiceConfigResult && 'type' in itemServiceConfigResult) {
|
|
47
|
-
// if (itemServiceConfigResult.type === 'notFound') {
|
|
48
|
-
// setError('Item not found');
|
|
49
|
-
// return;
|
|
50
|
-
// }
|
|
51
|
-
// // Use the config from the success result
|
|
52
|
-
// const finalItemServiceConfig = itemServiceConfigResult.config;
|
|
53
|
-
// // Create services manager with both services
|
|
54
|
-
// const manager = createServicesManager(
|
|
55
|
-
// createServicesMap()
|
|
56
|
-
// .addService(CurrentCartServiceDefinition, CurrentCartService, currentCartServiceConfig)
|
|
57
|
-
// // .addService(ItemServiceDefinition, ItemService, finalItemServiceConfig)
|
|
58
|
-
// );
|
|
59
|
-
// setServicesManager(manager);
|
|
60
|
-
// } else if (itemServiceConfigResult) {
|
|
61
|
-
// // Direct config provided
|
|
62
|
-
// const manager = createServicesManager(
|
|
63
|
-
// createServicesMap()
|
|
64
|
-
// .addService(CurrentCartServiceDefinition, CurrentCartService, currentCartServiceConfig)
|
|
65
|
-
// // .addService(ItemServiceDefinition, ItemService, itemServiceConfigResult)
|
|
66
|
-
// );
|
|
67
|
-
// setServicesManager(manager);
|
|
68
|
-
// } else {
|
|
69
|
-
// // Only cart service, no item service
|
|
70
|
-
// const manager = createServicesManager(
|
|
71
|
-
// createServicesMap()
|
|
72
|
-
// .addService(CurrentCartServiceDefinition, CurrentCartService, currentCartServiceConfig)
|
|
73
|
-
// );
|
|
74
|
-
// setServicesManager(manager);
|
|
75
|
-
// }
|
|
76
|
-
// } catch (err) {
|
|
77
|
-
// console.error('Failed to initialize services:', err);
|
|
78
|
-
// setError('Failed to initialize services');
|
|
79
|
-
// } finally {
|
|
80
|
-
// setIsLoading(false);
|
|
81
|
-
// }
|
|
82
|
-
// };
|
|
83
|
-
// initializeServices();
|
|
84
|
-
}, [itemId, itemServiceConfig, cartServiceConfig]);
|
|
85
|
-
// const hasServices = Boolean(servicesManager);
|
|
86
|
-
// return children({
|
|
87
|
-
// servicesManager,
|
|
88
|
-
// isLoading,
|
|
89
|
-
// error,
|
|
90
|
-
// hasServices
|
|
91
|
-
// });
|
|
92
|
-
console.log('oloSettingsServiceConfig', oloSettingsServiceConfig);
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
if (oloSettingsServiceConfig?.operation?._id) {
|
|
95
|
-
loadFulfillmentsServiceConfig(oloSettingsServiceConfig.operation).then((config) => {
|
|
96
|
-
console.log('config', config);
|
|
97
|
-
setFulfillmentsServiceConfig(config);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}, [oloSettingsServiceConfig?.operation?._id]);
|
|
101
|
-
return (_jsx(WixServices, { servicesMap: createServicesMap()
|
|
102
|
-
.addService(OLOSettingsServiceDefinition, OLOSettingsService, oloSettingsServiceConfig)
|
|
103
|
-
.addService(FulfillmentsServiceDefinition, FulfillmentsService, fulfillmentsServiceConfig), children: children }));
|
|
25
|
+
export const Root = ({ oloSettingsServiceConfig, children, }) => {
|
|
26
|
+
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(OLOSettingsServiceDefinition, OLOSettingsService, oloSettingsServiceConfig), children: children }));
|
|
104
27
|
};
|
|
105
28
|
/**
|
|
106
29
|
* Convenience wrapper that combines Root with ServicesManagerProvider
|
|
@@ -1,89 +1,58 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import * as operationsSDK from '@wix/auto_sdk_restaurants_operations';
|
|
3
|
-
import { TimeSlot } from '../../types/fulfillments-types.js';
|
|
4
|
-
interface
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
interface CurrentLocation {
|
|
11
|
-
name: string;
|
|
12
|
-
}
|
|
13
|
-
interface ExtraData {
|
|
14
|
-
acceptingOrders: boolean;
|
|
15
|
-
deliveryFee?: number;
|
|
16
|
-
minOrderAmount?: number;
|
|
17
|
-
freeDeliveryThreshold?: number;
|
|
18
|
-
taxRate?: number;
|
|
19
|
-
serviceCharge?: number;
|
|
20
|
-
isOnline?: boolean;
|
|
21
|
-
orderingDisabledReason?: string;
|
|
22
|
-
}
|
|
23
|
-
interface SettingsData {
|
|
24
|
-
currentTime: CurrentTime;
|
|
25
|
-
currentFulfillment: CurrentFulfillment;
|
|
26
|
-
currentLocation: CurrentLocation;
|
|
27
|
-
selectedFulfillment: any;
|
|
28
|
-
extraData: ExtraData;
|
|
29
|
-
isLoading: boolean;
|
|
30
|
-
error?: string | null;
|
|
31
|
-
}
|
|
32
|
-
interface SettingsRootProps {
|
|
33
|
-
children: (props: SettingsData) => React.ReactNode;
|
|
3
|
+
import { FulfillmentsServiceConfig, TimeSlot } from '../../types/fulfillments-types.js';
|
|
4
|
+
export interface RootProps {
|
|
5
|
+
children: (props: {
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
}) => React.ReactNode;
|
|
8
|
+
fulfillmentsServiceConfig?: FulfillmentsServiceConfig;
|
|
34
9
|
}
|
|
35
10
|
/**
|
|
36
|
-
* Core Settings component that provides
|
|
37
|
-
*
|
|
11
|
+
* Core Settings Root component that provides service context
|
|
12
|
+
* Wraps children with both OLOSettingsService and FulfillmentsService providers
|
|
38
13
|
*
|
|
39
14
|
* @example
|
|
40
15
|
* ```tsx
|
|
41
|
-
* <CoreSettings.Root>
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* <div>
|
|
45
|
-
* )
|
|
46
|
-
*
|
|
47
|
-
* ) : (
|
|
48
|
-
* <div>
|
|
49
|
-
* <h2>{currentDetails.name}</h2>
|
|
50
|
-
* <p>Accepting Orders: {extraData.acceptingOrders ? 'Yes' : 'No'}</p>
|
|
51
|
-
* <p>Delivery Fee: ${extraData.deliveryFee}</p>
|
|
52
|
-
* </div>
|
|
53
|
-
* )
|
|
54
|
-
* )}
|
|
16
|
+
* <CoreSettings.Root fulfillmentsServiceConfig={config}>
|
|
17
|
+
* <CoreSettings.CurrentTimeSlot>
|
|
18
|
+
* {({ timeSlot, hasDetails }) => (
|
|
19
|
+
* <div>{timeSlot?.dispatchType}</div>
|
|
20
|
+
* )}
|
|
21
|
+
* </CoreSettings.CurrentTimeSlot>
|
|
55
22
|
* </CoreSettings.Root>
|
|
56
23
|
* ```
|
|
57
24
|
*/
|
|
58
|
-
export declare const Root: React.FC<
|
|
59
|
-
interface CurrentTimeSlotProps {
|
|
25
|
+
export declare const Root: React.FC<RootProps>;
|
|
26
|
+
export interface CurrentTimeSlotProps {
|
|
60
27
|
children: (props: {
|
|
61
28
|
timeSlot: TimeSlot;
|
|
62
29
|
hasDetails: boolean;
|
|
63
30
|
}) => React.ReactNode;
|
|
64
31
|
}
|
|
65
32
|
/**
|
|
66
|
-
* Component that provides access to current
|
|
33
|
+
* Component that provides access to current time slot
|
|
67
34
|
*
|
|
68
35
|
* @example
|
|
69
36
|
* ```tsx
|
|
70
37
|
* <CoreSettings.CurrentTimeSlot>
|
|
71
|
-
* {({
|
|
38
|
+
* {({ timeSlot, hasDetails }) => (
|
|
72
39
|
* hasDetails ? (
|
|
73
40
|
* <div>
|
|
74
|
-
* <h3>{
|
|
41
|
+
* <h3>{timeSlot.dispatchType}</h3>
|
|
75
42
|
* </div>
|
|
76
43
|
* ) : (
|
|
77
|
-
* <div>No
|
|
44
|
+
* <div>No time slot selected</div>
|
|
78
45
|
* )
|
|
79
46
|
* )}
|
|
80
47
|
* </CoreSettings.CurrentTimeSlot>
|
|
81
48
|
* ```
|
|
82
49
|
*/
|
|
83
50
|
export declare const CurrentTimeSlot: React.FC<CurrentTimeSlotProps>;
|
|
84
|
-
interface CurrentFulfillmentProps {
|
|
51
|
+
export interface CurrentFulfillmentProps {
|
|
85
52
|
children: (props: {
|
|
86
|
-
fulfillment:
|
|
53
|
+
fulfillment: {
|
|
54
|
+
current?: operationsSDK.TimeSlot;
|
|
55
|
+
};
|
|
87
56
|
hasFulfillment: boolean;
|
|
88
57
|
availableOptions: string[];
|
|
89
58
|
}) => React.ReactNode;
|
|
@@ -106,9 +75,11 @@ interface CurrentFulfillmentProps {
|
|
|
106
75
|
* ```
|
|
107
76
|
*/
|
|
108
77
|
export declare const CurrentFulfillment: React.FC<CurrentFulfillmentProps>;
|
|
109
|
-
interface CurrentLocationProps {
|
|
78
|
+
export interface CurrentLocationProps {
|
|
110
79
|
children: (props: {
|
|
111
|
-
location:
|
|
80
|
+
location: {
|
|
81
|
+
name: string;
|
|
82
|
+
};
|
|
112
83
|
hasLocation: boolean;
|
|
113
84
|
}) => React.ReactNode;
|
|
114
85
|
}
|
|
@@ -118,21 +89,27 @@ interface CurrentLocationProps {
|
|
|
118
89
|
* @example
|
|
119
90
|
* ```tsx
|
|
120
91
|
* <CoreSettings.CurrentLocation>
|
|
121
|
-
* {({ location,
|
|
92
|
+
* {({ location, hasLocation }) => (
|
|
122
93
|
* <div>
|
|
123
|
-
* <p>{location.
|
|
124
|
-
* {hasCoordinates && (
|
|
125
|
-
* <p>Coordinates: {location.latitude}, {location.longitude}</p>
|
|
126
|
-
* )}
|
|
94
|
+
* <p>{location.name}</p>
|
|
127
95
|
* </div>
|
|
128
96
|
* )}
|
|
129
97
|
* </CoreSettings.CurrentLocation>
|
|
130
98
|
* ```
|
|
131
99
|
*/
|
|
132
100
|
export declare const CurrentLocation: React.FC<CurrentLocationProps>;
|
|
133
|
-
interface ExtraDataProps {
|
|
101
|
+
export interface ExtraDataProps {
|
|
134
102
|
children: (props: {
|
|
135
|
-
extraData:
|
|
103
|
+
extraData: {
|
|
104
|
+
acceptingOrders: boolean;
|
|
105
|
+
deliveryFee?: number;
|
|
106
|
+
minOrderAmount?: number;
|
|
107
|
+
freeDeliveryThreshold?: number;
|
|
108
|
+
taxRate?: number;
|
|
109
|
+
serviceCharge?: number;
|
|
110
|
+
isOnline?: boolean;
|
|
111
|
+
orderingDisabledReason?: string;
|
|
112
|
+
};
|
|
136
113
|
hasExtraData: boolean;
|
|
137
114
|
}) => React.ReactNode;
|
|
138
115
|
}
|
|
@@ -154,4 +131,3 @@ interface ExtraDataProps {
|
|
|
154
131
|
* ```
|
|
155
132
|
*/
|
|
156
133
|
export declare const ExtraData: React.FC<ExtraDataProps>;
|
|
157
|
-
export {};
|