@wix/headless-restaurants-olo 0.0.25 → 0.0.27
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/OLO.d.ts +0 -2
- package/cjs/dist/react/OLO.js +6 -6
- package/cjs/dist/react/core/OLO.d.ts +0 -1
- package/cjs/dist/react/core/OLO.js +1 -64
- package/dist/react/OLO.d.ts +0 -2
- package/dist/react/OLO.js +6 -6
- package/dist/react/core/OLO.d.ts +0 -1
- package/dist/react/core/OLO.js +1 -64
- package/package.json +3 -3
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,
|
|
@@ -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,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } 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';
|
|
@@ -23,69 +22,7 @@ import { OLOSettingsService, OLOSettingsServiceDefinition, } from '@wix/headless
|
|
|
23
22
|
* </CoreOLO.Root>
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
|
-
export const Root = ({
|
|
27
|
-
// const [servicesManager, setServicesManager] = useState<ServicesManager | null>(null);
|
|
28
|
-
// const [isLoading, setIsLoading] = useState(true);
|
|
29
|
-
// const [error, setError] = useState<string | undefined>();
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
// const initializeServices = async () => {
|
|
32
|
-
// setIsLoading(true);
|
|
33
|
-
// setError(undefined);
|
|
34
|
-
// try {
|
|
35
|
-
// // Load configurations if not provided
|
|
36
|
-
// const loadedConfigs = await Promise.all([
|
|
37
|
-
// cartServiceConfig || loadCurrentCartServiceConfig(),
|
|
38
|
-
// itemServiceConfig || (loadItemServiceConfig(itemId))
|
|
39
|
-
// ]);
|
|
40
|
-
// const [currentCartServiceConfig, itemServiceConfigResult] = loadedConfigs;
|
|
41
|
-
// // Handle item service config result (discriminated union)
|
|
42
|
-
// if (itemServiceConfigResult && 'type' in itemServiceConfigResult) {
|
|
43
|
-
// if (itemServiceConfigResult.type === 'notFound') {
|
|
44
|
-
// setError('Item not found');
|
|
45
|
-
// return;
|
|
46
|
-
// }
|
|
47
|
-
// // Use the config from the success result
|
|
48
|
-
// const finalItemServiceConfig = itemServiceConfigResult.config;
|
|
49
|
-
// // Create services manager with both services
|
|
50
|
-
// const manager = createServicesManager(
|
|
51
|
-
// createServicesMap()
|
|
52
|
-
// .addService(CurrentCartServiceDefinition, CurrentCartService, currentCartServiceConfig)
|
|
53
|
-
// // .addService(ItemServiceDefinition, ItemService, finalItemServiceConfig)
|
|
54
|
-
// );
|
|
55
|
-
// setServicesManager(manager);
|
|
56
|
-
// } else if (itemServiceConfigResult) {
|
|
57
|
-
// // Direct config provided
|
|
58
|
-
// const manager = createServicesManager(
|
|
59
|
-
// createServicesMap()
|
|
60
|
-
// .addService(CurrentCartServiceDefinition, CurrentCartService, currentCartServiceConfig)
|
|
61
|
-
// // .addService(ItemServiceDefinition, ItemService, itemServiceConfigResult)
|
|
62
|
-
// );
|
|
63
|
-
// setServicesManager(manager);
|
|
64
|
-
// } else {
|
|
65
|
-
// // Only cart service, no item service
|
|
66
|
-
// const manager = createServicesManager(
|
|
67
|
-
// createServicesMap()
|
|
68
|
-
// .addService(CurrentCartServiceDefinition, CurrentCartService, currentCartServiceConfig)
|
|
69
|
-
// );
|
|
70
|
-
// setServicesManager(manager);
|
|
71
|
-
// }
|
|
72
|
-
// } catch (err) {
|
|
73
|
-
// console.error('Failed to initialize services:', err);
|
|
74
|
-
// setError('Failed to initialize services');
|
|
75
|
-
// } finally {
|
|
76
|
-
// setIsLoading(false);
|
|
77
|
-
// }
|
|
78
|
-
// };
|
|
79
|
-
// initializeServices();
|
|
80
|
-
}, [itemId, itemServiceConfig, cartServiceConfig]);
|
|
81
|
-
// const hasServices = Boolean(servicesManager);
|
|
82
|
-
// return children({
|
|
83
|
-
// servicesManager,
|
|
84
|
-
// isLoading,
|
|
85
|
-
// error,
|
|
86
|
-
// hasServices
|
|
87
|
-
// });
|
|
88
|
-
console.log('oloSettingsServiceConfig', oloSettingsServiceConfig);
|
|
25
|
+
export const Root = ({ oloSettingsServiceConfig, children, }) => {
|
|
89
26
|
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(OLOSettingsServiceDefinition, OLOSettingsService, oloSettingsServiceConfig), children: children }));
|
|
90
27
|
};
|
|
91
28
|
/**
|
package/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/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,
|
package/dist/react/core/OLO.d.ts
CHANGED
|
@@ -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;
|
package/dist/react/core/OLO.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } 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';
|
|
@@ -23,69 +22,7 @@ import { OLOSettingsService, OLOSettingsServiceDefinition, } from '@wix/headless
|
|
|
23
22
|
* </CoreOLO.Root>
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
|
-
export const Root = ({
|
|
27
|
-
// const [servicesManager, setServicesManager] = useState<ServicesManager | null>(null);
|
|
28
|
-
// const [isLoading, setIsLoading] = useState(true);
|
|
29
|
-
// const [error, setError] = useState<string | undefined>();
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
// const initializeServices = async () => {
|
|
32
|
-
// setIsLoading(true);
|
|
33
|
-
// setError(undefined);
|
|
34
|
-
// try {
|
|
35
|
-
// // Load configurations if not provided
|
|
36
|
-
// const loadedConfigs = await Promise.all([
|
|
37
|
-
// cartServiceConfig || loadCurrentCartServiceConfig(),
|
|
38
|
-
// itemServiceConfig || (loadItemServiceConfig(itemId))
|
|
39
|
-
// ]);
|
|
40
|
-
// const [currentCartServiceConfig, itemServiceConfigResult] = loadedConfigs;
|
|
41
|
-
// // Handle item service config result (discriminated union)
|
|
42
|
-
// if (itemServiceConfigResult && 'type' in itemServiceConfigResult) {
|
|
43
|
-
// if (itemServiceConfigResult.type === 'notFound') {
|
|
44
|
-
// setError('Item not found');
|
|
45
|
-
// return;
|
|
46
|
-
// }
|
|
47
|
-
// // Use the config from the success result
|
|
48
|
-
// const finalItemServiceConfig = itemServiceConfigResult.config;
|
|
49
|
-
// // Create services manager with both services
|
|
50
|
-
// const manager = createServicesManager(
|
|
51
|
-
// createServicesMap()
|
|
52
|
-
// .addService(CurrentCartServiceDefinition, CurrentCartService, currentCartServiceConfig)
|
|
53
|
-
// // .addService(ItemServiceDefinition, ItemService, finalItemServiceConfig)
|
|
54
|
-
// );
|
|
55
|
-
// setServicesManager(manager);
|
|
56
|
-
// } else if (itemServiceConfigResult) {
|
|
57
|
-
// // Direct config provided
|
|
58
|
-
// const manager = createServicesManager(
|
|
59
|
-
// createServicesMap()
|
|
60
|
-
// .addService(CurrentCartServiceDefinition, CurrentCartService, currentCartServiceConfig)
|
|
61
|
-
// // .addService(ItemServiceDefinition, ItemService, itemServiceConfigResult)
|
|
62
|
-
// );
|
|
63
|
-
// setServicesManager(manager);
|
|
64
|
-
// } else {
|
|
65
|
-
// // Only cart service, no item service
|
|
66
|
-
// const manager = createServicesManager(
|
|
67
|
-
// createServicesMap()
|
|
68
|
-
// .addService(CurrentCartServiceDefinition, CurrentCartService, currentCartServiceConfig)
|
|
69
|
-
// );
|
|
70
|
-
// setServicesManager(manager);
|
|
71
|
-
// }
|
|
72
|
-
// } catch (err) {
|
|
73
|
-
// console.error('Failed to initialize services:', err);
|
|
74
|
-
// setError('Failed to initialize services');
|
|
75
|
-
// } finally {
|
|
76
|
-
// setIsLoading(false);
|
|
77
|
-
// }
|
|
78
|
-
// };
|
|
79
|
-
// initializeServices();
|
|
80
|
-
}, [itemId, itemServiceConfig, cartServiceConfig]);
|
|
81
|
-
// const hasServices = Boolean(servicesManager);
|
|
82
|
-
// return children({
|
|
83
|
-
// servicesManager,
|
|
84
|
-
// isLoading,
|
|
85
|
-
// error,
|
|
86
|
-
// hasServices
|
|
87
|
-
// });
|
|
88
|
-
console.log('oloSettingsServiceConfig', oloSettingsServiceConfig);
|
|
25
|
+
export const Root = ({ oloSettingsServiceConfig, children, }) => {
|
|
89
26
|
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(OLOSettingsServiceDefinition, OLOSettingsService, oloSettingsServiceConfig), children: children }));
|
|
90
27
|
};
|
|
91
28
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-restaurants-olo",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@radix-ui/react-slot": "^1.1.0",
|
|
57
57
|
"@wix/auto_sdk_restaurants_items": "^1.0.48",
|
|
58
58
|
"@wix/ecom": "^1.0.1461",
|
|
59
|
-
"@wix/headless-components": "0.0.
|
|
59
|
+
"@wix/headless-components": "0.0.31",
|
|
60
60
|
"@wix/headless-media": "0.0.17",
|
|
61
61
|
"@wix/headless-restaurants-menus": "0.0.20",
|
|
62
62
|
"@wix/headless-utils": "0.0.7",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"groupId": "com.wixpress.headless-components"
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
|
-
"falconPackageHash": "
|
|
79
|
+
"falconPackageHash": "3f6634518ff3a5952a1d846151fb2eb1126048e72ad48f2216c2fd45"
|
|
80
80
|
}
|