@pixelated-tech/components 3.4.2 → 3.5.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/README.md +32 -191
- package/dist/components/admin/componentusage/componentAnalysis.js +12 -4
- package/dist/components/admin/componentusage/componentDiscovery.js +20 -6
- package/dist/components/admin/site-health/seo-metrics.config.json +111 -0
- package/dist/components/admin/site-health/site-health-accessibility.js +5 -1
- package/dist/components/admin/site-health/site-health-axe-core.js +4 -0
- package/dist/components/admin/site-health/site-health-cloudwatch.integration.js +0 -5
- package/dist/components/admin/site-health/site-health-cloudwatch.js +7 -1
- package/dist/components/admin/site-health/site-health-dependency-vulnerabilities.js +4 -0
- package/dist/components/admin/site-health/site-health-github.js +6 -0
- package/dist/components/admin/site-health/site-health-google-analytics.js +6 -0
- package/dist/components/admin/site-health/site-health-google-search-console.js +6 -0
- package/dist/components/admin/site-health/site-health-on-site-seo.integration.js +379 -12
- package/dist/components/admin/site-health/site-health-on-site-seo.js +4 -0
- package/dist/components/admin/site-health/site-health-overview.js +11 -4
- package/dist/components/admin/site-health/site-health-performance.js +4 -0
- package/dist/components/admin/site-health/site-health-security.js +5 -1
- package/dist/components/admin/site-health/site-health-seo.js +5 -1
- package/dist/components/admin/site-health/site-health-template.js +19 -9
- package/dist/components/admin/site-health/site-health-uptime.js +4 -0
- package/dist/components/callout/callout.js +0 -10
- package/dist/components/carousel/carousel.js +15 -4
- package/dist/components/carousel/tiles.js +1 -1
- package/dist/components/cms/contentful.items.components.js +3 -4
- package/dist/components/cms/flickr.js +1 -1
- package/dist/components/cms/google.reviews.components.js +3 -3
- package/dist/components/cms/instagram.components.js +15 -5
- package/dist/components/cms/smartimage.js +2 -2
- package/dist/components/cms/wordpress.components.js +32 -6
- package/dist/components/cms/yelp.js +5 -0
- package/dist/components/config/config.server.js +7 -1
- package/dist/components/general/css.js +0 -1
- package/dist/components/general/image.js +0 -1
- package/dist/components/general/loading.js +2 -1
- package/dist/components/general/microinteractions.js +0 -1
- package/dist/components/general/modal.css +2 -4
- package/dist/components/general/modal.js +72 -30
- package/dist/components/general/sidepanel.js +16 -0
- package/dist/components/general/tab.js +1 -0
- package/dist/components/menu/menu-accordion.css +1 -1
- package/dist/components/menu/menu-accordion.js +15 -4
- package/dist/components/menu/menu-expando.js +21 -19
- package/dist/components/menu/menu-simple.js +14 -14
- package/dist/components/nerdjoke/nerdjoke.js +1 -1
- package/dist/components/seo/googlesearch.js +0 -1
- package/dist/components/seo/schema-blogposting.js +6 -1
- package/dist/components/seo/schema-recipe.js +34 -1
- package/dist/components/seo/schema-services.js +20 -2
- package/dist/components/shoppingcart/ebay.components.js +3 -3
- package/dist/components/shoppingcart/shoppingcart.components.js +76 -28
- package/dist/components/shoppingcart/shoppingcart.functions.js +4 -4
- package/dist/components/sitebuilder/config/CompoundFontSelector.js +13 -4
- package/dist/components/sitebuilder/config/ConfigBuilder.css +194 -5
- package/dist/components/sitebuilder/config/ConfigBuilder.js +183 -17
- package/dist/components/sitebuilder/config/FontSelector.js +13 -2
- package/dist/components/sitebuilder/config/routes-form.json +67 -0
- package/dist/components/sitebuilder/config/siteinfo-form.json +28 -14
- package/dist/components/sitebuilder/config/visualdesignform.json +4 -4
- package/dist/components/sitebuilder/form/formbuilder.js +1 -0
- package/dist/components/sitebuilder/form/formcomponents.js +2 -3
- package/dist/components/sitebuilder/form/formengine.js +6 -5
- package/dist/components/sitebuilder/form/formvalidator.js +5 -0
- package/dist/components/sitebuilder/page/components/PageBuilderUI.js +5 -1
- package/dist/components/structured/buzzwordbingo.css +0 -1
- package/dist/components/structured/recipe.js +1 -1
- package/dist/components/structured/socialcard.js +2 -2
- package/dist/components/utilities/functions.js +82 -1
- package/dist/components/utilities/gemini-api.client.js +76 -0
- package/dist/components/utilities/gemini-api.server.js +185 -0
- package/dist/data/routes.json +5 -5
- package/dist/index.adminclient.js +30 -0
- package/dist/index.adminserver.js +21 -0
- package/dist/index.js +4 -18
- package/dist/index.server.js +15 -28
- package/dist/types/components/admin/componentusage/componentAnalysis.d.ts.map +1 -1
- package/dist/types/components/admin/componentusage/componentDiscovery.d.ts +1 -1
- package/dist/types/components/admin/componentusage/componentDiscovery.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-accessibility.d.ts +7 -4
- package/dist/types/components/admin/site-health/site-health-accessibility.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-axe-core.d.ts +7 -4
- package/dist/types/components/admin/site-health/site-health-axe-core.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-cloudwatch.d.ts +9 -6
- package/dist/types/components/admin/site-health/site-health-cloudwatch.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-cloudwatch.integration.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-dependency-vulnerabilities.d.ts +7 -4
- package/dist/types/components/admin/site-health/site-health-dependency-vulnerabilities.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-github.d.ts +9 -6
- package/dist/types/components/admin/site-health/site-health-github.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-google-analytics.d.ts +9 -6
- package/dist/types/components/admin/site-health/site-health-google-analytics.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-google-search-console.d.ts +9 -6
- package/dist/types/components/admin/site-health/site-health-google-search-console.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-on-site-seo.d.ts +8 -3
- package/dist/types/components/admin/site-health/site-health-on-site-seo.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-on-site-seo.integration.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-overview.d.ts +7 -4
- package/dist/types/components/admin/site-health/site-health-overview.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-performance.d.ts +7 -4
- package/dist/types/components/admin/site-health/site-health-performance.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-security.d.ts +7 -4
- package/dist/types/components/admin/site-health/site-health-security.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-seo.d.ts +7 -4
- package/dist/types/components/admin/site-health/site-health-seo.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-template.d.ts +12 -10
- package/dist/types/components/admin/site-health/site-health-template.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-uptime.d.ts +7 -4
- package/dist/types/components/admin/site-health/site-health-uptime.d.ts.map +1 -1
- package/dist/types/components/callout/callout.d.ts +3 -3
- package/dist/types/components/callout/callout.d.ts.map +1 -1
- package/dist/types/components/carousel/carousel.d.ts +16 -7
- package/dist/types/components/carousel/carousel.d.ts.map +1 -1
- package/dist/types/components/carousel/tiles.d.ts +3 -6
- package/dist/types/components/carousel/tiles.d.ts.map +1 -1
- package/dist/types/components/cms/flickr.d.ts +3 -6
- package/dist/types/components/cms/flickr.d.ts.map +1 -1
- package/dist/types/components/cms/google.reviews.components.d.ts +1 -7
- package/dist/types/components/cms/google.reviews.components.d.ts.map +1 -1
- package/dist/types/components/cms/hubspot.components.d.ts +1 -2
- package/dist/types/components/cms/hubspot.components.d.ts.map +1 -1
- package/dist/types/components/cms/instagram.components.d.ts +14 -9
- package/dist/types/components/cms/instagram.components.d.ts.map +1 -1
- package/dist/types/components/cms/smartimage.d.ts +2 -28
- package/dist/types/components/cms/smartimage.d.ts.map +1 -1
- package/dist/types/components/cms/wordpress.components.d.ts +33 -14
- package/dist/types/components/cms/wordpress.components.d.ts.map +1 -1
- package/dist/types/components/cms/yelp.d.ts +9 -4
- package/dist/types/components/cms/yelp.d.ts.map +1 -1
- package/dist/types/components/config/config.server.d.ts +9 -6
- package/dist/types/components/config/config.server.d.ts.map +1 -1
- package/dist/types/components/general/loading.d.ts +5 -1
- package/dist/types/components/general/loading.d.ts.map +1 -1
- package/dist/types/components/general/microinteractions.d.ts +1 -3
- package/dist/types/components/general/microinteractions.d.ts.map +1 -1
- package/dist/types/components/general/modal.d.ts +11 -5
- package/dist/types/components/general/modal.d.ts.map +1 -1
- package/dist/types/components/general/semantic.d.ts +3 -3
- package/dist/types/components/general/sidepanel.d.ts +20 -13
- package/dist/types/components/general/sidepanel.d.ts.map +1 -1
- package/dist/types/components/general/tab.d.ts +1 -2
- package/dist/types/components/general/tab.d.ts.map +1 -1
- package/dist/types/components/menu/menu-accordion.d.ts +22 -9
- package/dist/types/components/menu/menu-accordion.d.ts.map +1 -1
- package/dist/types/components/menu/menu-expando.d.ts +14 -5
- package/dist/types/components/menu/menu-expando.d.ts.map +1 -1
- package/dist/types/components/menu/menu-simple.d.ts +4 -5
- package/dist/types/components/menu/menu-simple.d.ts.map +1 -1
- package/dist/types/components/nerdjoke/nerdjoke.d.ts +1 -1
- package/dist/types/components/nerdjoke/nerdjoke.d.ts.map +1 -1
- package/dist/types/components/seo/googleanalytics.d.ts.map +1 -1
- package/dist/types/components/seo/metadata.components.d.ts +2 -2
- package/dist/types/components/seo/metadata.components.d.ts.map +1 -1
- package/dist/types/components/seo/schema-blogposting.d.ts +7 -4
- package/dist/types/components/seo/schema-blogposting.d.ts.map +1 -1
- package/dist/types/components/seo/schema-recipe.d.ts +29 -30
- package/dist/types/components/seo/schema-recipe.d.ts.map +1 -1
- package/dist/types/components/seo/schema-services.d.ts +19 -9
- package/dist/types/components/seo/schema-services.d.ts.map +1 -1
- package/dist/types/components/shoppingcart/paypal.d.ts +1 -1
- package/dist/types/components/shoppingcart/paypal.d.ts.map +1 -1
- package/dist/types/components/shoppingcart/shoppingcart.components.d.ts +77 -28
- package/dist/types/components/shoppingcart/shoppingcart.components.d.ts.map +1 -1
- package/dist/types/components/shoppingcart/shoppingcart.functions.d.ts +4 -23
- package/dist/types/components/shoppingcart/shoppingcart.functions.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/config/CompoundFontSelector.d.ts +10 -11
- package/dist/types/components/sitebuilder/config/CompoundFontSelector.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/config/ConfigBuilder.d.ts +41 -174
- package/dist/types/components/sitebuilder/config/ConfigBuilder.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/config/FontSelector.d.ts +12 -13
- package/dist/types/components/sitebuilder/config/FontSelector.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/form/formbuilder.d.ts +7 -3
- package/dist/types/components/sitebuilder/form/formbuilder.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/form/formcomponents.d.ts +1 -1
- package/dist/types/components/sitebuilder/form/formcomponents.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/form/formengine.d.ts +1 -2
- package/dist/types/components/sitebuilder/form/formengine.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/form/formextractor.d.ts +5 -4
- package/dist/types/components/sitebuilder/form/formextractor.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/form/formtypes.d.ts +3 -3
- package/dist/types/components/sitebuilder/form/formtypes.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/form/formvalidator.d.ts +8 -3
- package/dist/types/components/sitebuilder/form/formvalidator.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/page/components/ComponentPropertiesForm.d.ts +2 -3
- package/dist/types/components/sitebuilder/page/components/ComponentPropertiesForm.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/page/components/ComponentSelector.d.ts +2 -3
- package/dist/types/components/sitebuilder/page/components/ComponentSelector.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/page/components/ComponentTree.d.ts +2 -3
- package/dist/types/components/sitebuilder/page/components/ComponentTree.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/page/components/PageBuilderUI.d.ts +8 -7
- package/dist/types/components/sitebuilder/page/components/PageBuilderUI.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/page/components/PageEngine.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/page/components/SaveLoadSection.d.ts +2 -3
- package/dist/types/components/sitebuilder/page/components/SaveLoadSection.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/page/lib/componentMap.d.ts +1 -1
- package/dist/types/components/structured/markdown.d.ts +1 -3
- package/dist/types/components/structured/markdown.d.ts.map +1 -1
- package/dist/types/components/structured/recipe.d.ts +5 -32
- package/dist/types/components/structured/recipe.d.ts.map +1 -1
- package/dist/types/components/structured/socialcard.d.ts +4 -0
- package/dist/types/components/structured/socialcard.d.ts.map +1 -1
- package/dist/types/components/structured/timeline.d.ts +1 -3
- package/dist/types/components/structured/timeline.d.ts.map +1 -1
- package/dist/types/components/utilities/functions.d.ts +20 -0
- package/dist/types/components/utilities/functions.d.ts.map +1 -1
- package/dist/types/components/utilities/gemini-api.client.d.ts +38 -0
- package/dist/types/components/utilities/gemini-api.client.d.ts.map +1 -0
- package/dist/types/components/utilities/gemini-api.server.d.ts +17 -0
- package/dist/types/components/utilities/gemini-api.server.d.ts.map +1 -0
- package/dist/types/index.adminclient.d.ts +27 -0
- package/dist/types/index.adminclient.d.ts.map +1 -0
- package/dist/types/index.adminserver.d.ts +19 -0
- package/dist/types/index.adminserver.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -18
- package/dist/types/index.server.d.ts +5 -28
- package/dist/types/stories/admin/site-health.stories.d.ts +4 -0
- package/dist/types/stories/admin/site-health.stories.d.ts.map +1 -1
- package/dist/types/stories/general/sidepanel.stories.d.ts.map +1 -1
- package/dist/types/stories/general/smartimage.stories.d.ts +74 -2
- package/dist/types/stories/general/smartimage.stories.d.ts.map +1 -1
- package/dist/types/tests/site-health-cloudwatch.test.d.ts +2 -0
- package/dist/types/tests/site-health-cloudwatch.test.d.ts.map +1 -0
- package/dist/types/tests/site-health-on-site-seo.integration.test.d.ts +2 -0
- package/dist/types/tests/site-health-on-site-seo.integration.test.d.ts.map +1 -0
- package/package.json +20 -10
- package/README.COMPONENTS.md +0 -2162
- package/dist/components/cms/pixelated.linkedin.js +0 -180
- package/dist/components/cms/pixelated.linkedin1.js +0 -84
- package/dist/components/cms/pixelated.linkedin2.js +0 -92
- package/dist/types/components/cms/pixelated.linkedin.d.ts +0 -2
- package/dist/types/components/cms/pixelated.linkedin.d.ts.map +0 -1
- package/dist/types/components/cms/pixelated.linkedin1.d.ts +0 -2
- package/dist/types/components/cms/pixelated.linkedin1.d.ts.map +0 -1
- package/dist/types/components/cms/pixelated.linkedin2.d.ts +0 -2
- package/dist/types/components/cms/pixelated.linkedin2.d.ts.map +0 -1
- package/dist/types/tests/pixelated.menu-expando.test.d.ts +0 -2
- package/dist/types/tests/pixelated.menu-expando.test.d.ts.map +0 -1
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
1
|
'use client';
|
|
3
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
3
|
import { useEffect, useRef } from 'react';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
5
|
import './menu-expando.css';
|
|
6
|
+
MenuExpando.propTypes = {
|
|
7
|
+
menuItems: PropTypes.oneOfType([
|
|
8
|
+
PropTypes.objectOf(PropTypes.string),
|
|
9
|
+
PropTypes.arrayOf(PropTypes.shape({
|
|
10
|
+
name: PropTypes.string.isRequired,
|
|
11
|
+
path: PropTypes.string.isRequired,
|
|
12
|
+
routes: PropTypes.array,
|
|
13
|
+
}))
|
|
14
|
+
]).isRequired
|
|
15
|
+
};
|
|
7
16
|
export function MenuExpando(props) {
|
|
8
17
|
const detailsRef = useRef(null);
|
|
9
18
|
const ulRef = useRef(null);
|
|
@@ -91,11 +100,11 @@ export function MenuExpando(props) {
|
|
|
91
100
|
if (Array.isArray(props.menuItems)) {
|
|
92
101
|
// Array format like MenuAccordion
|
|
93
102
|
for (const item of props.menuItems) {
|
|
94
|
-
if (item.routes && item.routes.length > 0) {
|
|
103
|
+
if (item && item.routes && item.routes.length > 0) {
|
|
95
104
|
// Item has nested routes - create expandable submenu
|
|
96
105
|
myItems.push(_jsx("li", { children: _jsxs("details", { className: "menuExpandoNested", children: [_jsx("summary", { children: _jsx("a", { href: item.path, children: item.name }) }), _jsx("ul", { children: item.routes.map((route) => (_jsx(MenuExpandoItem, { name: route.name, href: route.path }, route.name))) })] }) }, item.name));
|
|
97
106
|
}
|
|
98
|
-
else {
|
|
107
|
+
else if (item) {
|
|
99
108
|
// Regular item without nested routes
|
|
100
109
|
myItems.push(_jsx(MenuExpandoItem, { name: item.name, href: item.path }, item.name));
|
|
101
110
|
}
|
|
@@ -104,31 +113,25 @@ export function MenuExpando(props) {
|
|
|
104
113
|
else {
|
|
105
114
|
// Object format
|
|
106
115
|
for (const itemKey in props.menuItems) {
|
|
107
|
-
|
|
116
|
+
const href = props.menuItems[itemKey];
|
|
117
|
+
if (typeof href === 'string') {
|
|
118
|
+
myItems.push(_jsx(MenuExpandoItem, { name: itemKey, href: href }, itemKey));
|
|
119
|
+
}
|
|
108
120
|
}
|
|
109
121
|
}
|
|
110
122
|
return myItems;
|
|
111
123
|
}
|
|
112
124
|
return (_jsx("div", { className: "menuExpando", id: "menuExpando", children: _jsxs("details", { className: "menu-expando-wrapper", id: "menu-expando-wrapper", ref: detailsRef, children: [_jsx("summary", {}), _jsx("ul", { ref: ulRef, children: generateMenuItems() })] }) }));
|
|
113
125
|
}
|
|
114
|
-
MenuExpando.propTypes = {
|
|
115
|
-
menuItems: PropTypes.oneOfType([
|
|
116
|
-
PropTypes.object,
|
|
117
|
-
PropTypes.arrayOf(PropTypes.shape({
|
|
118
|
-
name: PropTypes.string.isRequired,
|
|
119
|
-
path: PropTypes.string.isRequired,
|
|
120
|
-
routes: PropTypes.array,
|
|
121
|
-
}))
|
|
122
|
-
]).isRequired
|
|
123
|
-
};
|
|
124
|
-
export function MenuExpandoItem(props) {
|
|
125
|
-
return (_jsx("li", { children: _jsx("a", { href: props.href, children: props.name }) }));
|
|
126
|
-
}
|
|
127
126
|
MenuExpandoItem.propTypes = {
|
|
128
127
|
name: PropTypes.string.isRequired,
|
|
129
128
|
href: PropTypes.string.isRequired
|
|
130
129
|
};
|
|
131
|
-
export function
|
|
130
|
+
export function MenuExpandoItem(props) {
|
|
131
|
+
return (_jsx("li", { children: _jsx("a", { href: props.href, children: props.name }) }));
|
|
132
|
+
}
|
|
133
|
+
MenuExpandoButton.propTypes = {};
|
|
134
|
+
export function MenuExpandoButton(props) {
|
|
132
135
|
function handleMenuExpandoButtonClick(event) {
|
|
133
136
|
event.preventDefault();
|
|
134
137
|
event.stopPropagation();
|
|
@@ -144,4 +147,3 @@ export function MenuExpandoButton() {
|
|
|
144
147
|
}
|
|
145
148
|
return (_jsx("div", { className: "menuExpandoButton", id: "menuExpandoButton", onClick: handleMenuExpandoButtonClick, onKeyDown: handleKeyDown, tabIndex: 0, role: "button", "aria-label": "Toggle mobile menu", children: _jsx("img", { src: "/images/icons/mobile-menu2.png", title: "Mobile Menu", alt: "Mobile Menu" }) }));
|
|
146
149
|
}
|
|
147
|
-
MenuExpandoButton.propTypes = {};
|
|
@@ -3,26 +3,26 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import './menu-simple.css';
|
|
6
|
-
|
|
6
|
+
const menuItemShape = PropTypes.shape({
|
|
7
|
+
name: PropTypes.string.isRequired,
|
|
8
|
+
path: PropTypes.string,
|
|
9
|
+
target: PropTypes.string,
|
|
10
|
+
hidden: PropTypes.bool,
|
|
11
|
+
routes: PropTypes.array,
|
|
12
|
+
});
|
|
7
13
|
MenuSimple.propTypes = {
|
|
8
|
-
|
|
9
|
-
menuItems: PropTypes.arrayOf(PropTypes.shape({
|
|
10
|
-
name: PropTypes.string.isRequired,
|
|
11
|
-
path: PropTypes.string.isRequired,
|
|
12
|
-
target: PropTypes.string,
|
|
13
|
-
hidden: PropTypes.bool,
|
|
14
|
-
routes: PropTypes.array,
|
|
15
|
-
})).isRequired,
|
|
14
|
+
menuItems: PropTypes.arrayOf(menuItemShape).isRequired,
|
|
16
15
|
};
|
|
17
16
|
export function MenuSimple(props) {
|
|
18
17
|
function generateMenuItems() {
|
|
19
18
|
const myItems = [];
|
|
20
19
|
for (const itemKey in props.menuItems) {
|
|
21
20
|
const myItem = props.menuItems[itemKey];
|
|
22
|
-
if (myItem
|
|
23
|
-
continue;
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
if (!myItem)
|
|
22
|
+
continue; // Skip null/undefined items
|
|
23
|
+
if (myItem.routes)
|
|
24
|
+
continue; // Skip nested routes
|
|
25
|
+
myItems.push(_jsx(MenuSimpleItem, { name: myItem.name, path: myItem.path || '', target: myItem.target || undefined, hidden: myItem.hidden || undefined }, itemKey));
|
|
26
26
|
}
|
|
27
27
|
return myItems;
|
|
28
28
|
}
|
|
@@ -45,7 +45,7 @@ export function MenuSimple(props) {
|
|
|
45
45
|
/* ========== MENU ITEM ========== */
|
|
46
46
|
MenuSimpleItem.propTypes = {
|
|
47
47
|
name: PropTypes.string.isRequired,
|
|
48
|
-
path: PropTypes.string,
|
|
48
|
+
path: PropTypes.string.isRequired,
|
|
49
49
|
target: PropTypes.string,
|
|
50
50
|
hidden: PropTypes.bool,
|
|
51
51
|
routes: PropTypes.array,
|
|
@@ -7,7 +7,7 @@ import "./nerdjoke.css";
|
|
|
7
7
|
const debug = false;
|
|
8
8
|
const TIME_LIMIT = 15;
|
|
9
9
|
NerdJoke.propTypes = {};
|
|
10
|
-
export function NerdJoke(
|
|
10
|
+
export function NerdJoke(props) {
|
|
11
11
|
const [joke, setJoke] = useState({ question: "", answer: "" });
|
|
12
12
|
const timerIntervalRef = useRef(null);
|
|
13
13
|
const jokeIntervalRef = useRef(null);
|
|
@@ -23,7 +23,6 @@ GoogleSearch.propTypes = {
|
|
|
23
23
|
};
|
|
24
24
|
export function GoogleSearch(props) {
|
|
25
25
|
if (typeof document !== 'undefined') {
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
27
26
|
const gsearch = (function () {
|
|
28
27
|
const gcse = document.createElement("script");
|
|
29
28
|
gcse.type = "text/javascript";
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
SchemaBlogPosting.propTypes = {
|
|
4
|
+
post: PropTypes.object.isRequired,
|
|
5
|
+
};
|
|
6
|
+
export function SchemaBlogPosting(props) {
|
|
7
|
+
const { post } = props;
|
|
3
8
|
return (_jsx("script", { type: "application/ld+json", dangerouslySetInnerHTML: {
|
|
4
9
|
__html: JSON.stringify(post),
|
|
5
10
|
} }));
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
/**
|
|
4
|
+
* Recipe Schema Component
|
|
5
|
+
* Generates JSON-LD structured data for recipes
|
|
6
|
+
* https://schema.org/Recipe
|
|
7
|
+
*/
|
|
8
|
+
RecipeSchema.propTypes = {
|
|
9
|
+
recipe: PropTypes.shape({
|
|
10
|
+
'@context': PropTypes.string.isRequired,
|
|
11
|
+
'@type': PropTypes.string.isRequired,
|
|
12
|
+
name: PropTypes.string.isRequired,
|
|
13
|
+
description: PropTypes.string,
|
|
14
|
+
author: PropTypes.shape({
|
|
15
|
+
'@type': PropTypes.string.isRequired,
|
|
16
|
+
name: PropTypes.string.isRequired,
|
|
17
|
+
}),
|
|
18
|
+
datePublished: PropTypes.string,
|
|
19
|
+
image: PropTypes.string,
|
|
20
|
+
recipeYield: PropTypes.string,
|
|
21
|
+
prepTime: PropTypes.string,
|
|
22
|
+
cookTime: PropTypes.string,
|
|
23
|
+
totalTime: PropTypes.string,
|
|
24
|
+
recipeCategory: PropTypes.string,
|
|
25
|
+
recipeCuisine: PropTypes.string,
|
|
26
|
+
recipeIngredient: PropTypes.arrayOf(PropTypes.string),
|
|
27
|
+
recipeInstructions: PropTypes.arrayOf(PropTypes.shape({
|
|
28
|
+
'@type': PropTypes.string.isRequired,
|
|
29
|
+
text: PropTypes.string.isRequired,
|
|
30
|
+
})),
|
|
31
|
+
license: PropTypes.string,
|
|
32
|
+
}).isRequired,
|
|
33
|
+
};
|
|
34
|
+
export function RecipeSchema(props) {
|
|
35
|
+
const { recipe } = props;
|
|
3
36
|
return (_jsx("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: JSON.stringify(recipe) } }));
|
|
4
37
|
}
|
|
5
38
|
export default RecipeSchema;
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
ServicesSchema.propTypes = {
|
|
4
|
+
provider: PropTypes.shape({
|
|
5
|
+
name: PropTypes.string.isRequired,
|
|
6
|
+
url: PropTypes.string.isRequired,
|
|
7
|
+
logo: PropTypes.string,
|
|
8
|
+
telephone: PropTypes.string,
|
|
9
|
+
email: PropTypes.string,
|
|
10
|
+
}).isRequired,
|
|
11
|
+
services: PropTypes.arrayOf(PropTypes.shape({
|
|
12
|
+
name: PropTypes.string.isRequired,
|
|
13
|
+
description: PropTypes.string.isRequired,
|
|
14
|
+
url: PropTypes.string,
|
|
15
|
+
image: PropTypes.string,
|
|
16
|
+
areaServed: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
17
|
+
})).isRequired,
|
|
18
|
+
};
|
|
19
|
+
export function ServicesSchema(props) {
|
|
20
|
+
const { provider, services } = props;
|
|
21
|
+
const serviceObjects = services.map((service) => ({
|
|
4
22
|
'@type': 'Service',
|
|
5
23
|
name: service.name,
|
|
6
24
|
description: service.description,
|
|
@@ -5,7 +5,7 @@ import PropTypes from "prop-types";
|
|
|
5
5
|
import { Carousel } from '../carousel/carousel';
|
|
6
6
|
import { SmartImage } from "../cms/smartimage";
|
|
7
7
|
import { defaultEbayProps, ebaySunglassCategory, getEbayItems, getEbayItem, getShoppingCartItem } from "./ebay.functions";
|
|
8
|
-
import {
|
|
8
|
+
import { addToShoppingCart } from "./shoppingcart.functions";
|
|
9
9
|
import { AddToCartButton, /* GoToCartButton */ ViewItemDetails } from "./shoppingcart.components";
|
|
10
10
|
import { getCloudinaryRemoteFetchURL as getImg } from "../cms/cloudinary";
|
|
11
11
|
import { Loading, ToggleLoading } from "../general/loading";
|
|
@@ -143,7 +143,7 @@ export function EbayListItem(props) {
|
|
|
143
143
|
? _jsx(EbayItemHeader, { url: itemURL, target: itemURLTarget, title: thisItem.title })
|
|
144
144
|
: _jsx(EbayItemHeader, { title: thisItem.title }) }), _jsxs("div", { className: "ebayItemDetails grid12", children: [_jsxs("div", { children: [_jsx("b", { children: "Item ID: " }), thisItem.legacyItemId] }), _jsxs("div", { children: [_jsx("b", { children: "Quantity: " }), thisItem.categories[0].categoryId == ebaySunglassCategory ? 1 : 10] }), _jsxs("div", { children: [_jsx("b", { children: "Condition: " }), thisItem.condition] }), _jsxs("div", { children: [_jsx("b", { children: "Seller: " }), thisItem.seller.username, " (", thisItem.seller.feedbackScore, ")", _jsx("br", {}), thisItem.seller.feedbackPercentage, "% positive"] }), _jsxs("div", { children: [_jsx("b", { children: "Buying Options: " }), thisItem.buyingOptions[0]] }), _jsxs("div", { children: [_jsx("b", { children: "Location: " }), thisItem.itemLocation.postalCode + ", " + thisItem.itemLocation.country] }), _jsxs("div", { children: [_jsx("b", { children: "Listing Date: " }), thisItem.itemCreationDate] })] }), _jsx("div", { className: "ebayItemPrice", children: itemURL
|
|
145
145
|
? _jsxs("a", { href: itemURL, target: itemURLTarget, rel: "noreferrer", children: ["$", thisItem.price.value + " " + thisItem.price.currency] })
|
|
146
|
-
: "$" + thisItem.price.value + " " + thisItem.price.currency }), _jsx("br", {}), _jsxs("div", { className: "ebayItemAddToCart", children: [_jsx(ViewItemDetails, { href: "/store", itemID: thisItem.legacyItemId }), _jsx(AddToCartButton, { handler:
|
|
146
|
+
: "$" + thisItem.price.value + " " + thisItem.price.currency }), _jsx("br", {}), _jsxs("div", { className: "ebayItemAddToCart", children: [_jsx(ViewItemDetails, { href: "/store", itemID: thisItem.legacyItemId }), _jsx(AddToCartButton, { handler: addToShoppingCart, item: shoppingCartItem, itemID: thisItem.legacyItemId })] })] })] }));
|
|
147
147
|
}
|
|
148
148
|
EbayItemHeader.propTypes = {
|
|
149
149
|
title: PropTypes.string.isRequired,
|
|
@@ -195,7 +195,7 @@ export function EbayItemDetail(props) {
|
|
|
195
195
|
? _jsx(EbayItemHeader, { url: itemURL, title: thisItem.title })
|
|
196
196
|
: _jsx(EbayItemHeader, { title: thisItem.title }) }), _jsx("br", {}), _jsx("div", { className: "ebayItemPhotoCarousel grid-s1-e7", children: _jsx(Carousel, { cards: images, draggable: true, imgFit: "contain" }) }), _jsxs("div", { className: "grid-s7-e13", children: [_jsx("div", { className: "ebayItemDetails grid12", children: _jsx("div", { dangerouslySetInnerHTML: { __html: thisItem.description.replace(/(<br\s*\/?>\s*){2,}/gi, '') } }) }), _jsx("br", {}), _jsxs("div", { className: "ebayItemDetails grid12", children: [_jsxs("div", { children: [_jsx("b", { children: "Item ID: " }), thisItem.legacyItemId] }), _jsxs("div", { children: [_jsx("b", { children: "Quantity: " }), thisItem.categoryId == ebaySunglassCategory ? 1 : 10] }), _jsxs("div", { children: [_jsx("b", { children: "Category: " }), thisItem.categoryPath] }), _jsxs("div", { children: [_jsx("b", { children: "Condition: " }), thisItem.condition] }), _jsxs("div", { children: [_jsx("b", { children: "Seller: " }), thisItem.seller.username, " (", thisItem.seller.feedbackScore, ")", _jsx("br", {}), thisItem.seller.feedbackPercentage, "% positive"] }), _jsxs("div", { children: [_jsx("b", { children: "Buying Options: " }), thisItem.buyingOptions[0]] }), _jsxs("div", { children: [_jsx("b", { children: "Location: " }), thisItem.itemLocation.city + ", " + thisItem.itemLocation.stateOrProvince] }), _jsxs("div", { children: [_jsx("b", { children: "Listing Date: " }), thisItem.itemCreationDate] }), _jsx("br", {})] }), _jsx("div", { className: "ebayItemPrice", children: itemURL
|
|
197
197
|
? _jsxs("a", { href: itemURL, target: itemURLTarget, rel: "noreferrer", children: ["$", thisItem.price.value + " " + thisItem.price.currency] })
|
|
198
|
-
: "$" + thisItem.price.value + " " + thisItem.price.currency }), _jsx("br", {}), _jsx("div", { className: "ebayItemAddToCart", children: _jsx(AddToCartButton, { handler:
|
|
198
|
+
: "$" + thisItem.price.value + " " + thisItem.price.currency }), _jsx("br", {}), _jsx("div", { className: "ebayItemAddToCart", children: _jsx(AddToCartButton, { handler: addToShoppingCart, item: shoppingCartItem, itemID: thisItem.legacyItemId }) })] })] }) }));
|
|
199
199
|
}
|
|
200
200
|
else {
|
|
201
201
|
return (_jsx(_Fragment, { children: _jsx("div", { id: "ebayItems", className: "ebayItems", children: _jsx("div", { className: "centered", children: "Loading..." }) }) }));
|
|
@@ -11,7 +11,7 @@ import '../sitebuilder/form/form.css';
|
|
|
11
11
|
import { MicroInteractions } from '../general/microinteractions';
|
|
12
12
|
import { Modal, handleModalOpen } from '../general/modal';
|
|
13
13
|
import { Table } from "../general/table";
|
|
14
|
-
import { getCart, getShippingInfo,
|
|
14
|
+
import { getCart, getShippingInfo, setShippingInfo, setDiscountCodes, getRemoteDiscountCodes, getCheckoutData, removeFromShoppingCart, clearShoppingCart, formatAsUSD, getCartItemCount } from "./shoppingcart.functions";
|
|
15
15
|
import { usePixelatedConfig } from '../config/config.client';
|
|
16
16
|
import { SmartImage } from '../cms/smartimage';
|
|
17
17
|
import shippingToData from "./shipping.to.json";
|
|
@@ -20,10 +20,13 @@ const debug = false;
|
|
|
20
20
|
/* ================================================ */
|
|
21
21
|
/* ========== SHOPPING CART UI COMPONENT ========== */
|
|
22
22
|
/* ================================================ */
|
|
23
|
+
ShoppingCart.propTypes = {
|
|
24
|
+
payPalClientID: PropTypes.string.isRequired,
|
|
25
|
+
};
|
|
23
26
|
export function ShoppingCart(props) {
|
|
24
27
|
const [shoppingCart, setShoppingCart] = useState();
|
|
25
|
-
const [
|
|
26
|
-
const [
|
|
28
|
+
const [shippingData, setShippingData] = useState();
|
|
29
|
+
const [checkoutData, setcheckoutData] = useState();
|
|
27
30
|
const [orderData, setOrderData] = useState();
|
|
28
31
|
const [progressStep, setProgressStep] = useState("EmptyCart");
|
|
29
32
|
function SetProgressStep(step) {
|
|
@@ -61,7 +64,7 @@ export function ShoppingCart(props) {
|
|
|
61
64
|
setCart(shoppingCart ?? []);
|
|
62
65
|
}, [shoppingCart]); */
|
|
63
66
|
/* useEffect(() => {
|
|
64
|
-
// UPDATE LOCALSTORAGE IF
|
|
67
|
+
// UPDATE LOCALSTORAGE IF SHIPPINGDATA STATE CHANGES
|
|
65
68
|
setShippingInfo(shippingInfo);
|
|
66
69
|
}, [shippingInfo]); */
|
|
67
70
|
useEffect(() => {
|
|
@@ -69,11 +72,11 @@ export function ShoppingCart(props) {
|
|
|
69
72
|
(async () => {
|
|
70
73
|
setDiscountCodes(await getRemoteDiscountCodes());
|
|
71
74
|
})();
|
|
72
|
-
// UPDATE SHOPPINGCART AND
|
|
75
|
+
// UPDATE SHOPPINGCART AND SHIPPINGDATA STATES IF LOCALSTORAGE CHANGES
|
|
73
76
|
function handleStorageChange() {
|
|
74
77
|
setShoppingCart(getCart());
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
setShippingData(getShippingInfo());
|
|
79
|
+
setcheckoutData(getCheckoutData());
|
|
77
80
|
SetProgressStep();
|
|
78
81
|
}
|
|
79
82
|
window.addEventListener('storage', handleStorageChange);
|
|
@@ -85,11 +88,11 @@ export function ShoppingCart(props) {
|
|
|
85
88
|
useEffect(() => {
|
|
86
89
|
// LOAD THE SHIPPING INFO FORM WITH VALUES IF SHIPPING INFO HAS ALREADY BEEN SAVED
|
|
87
90
|
const form = document.getElementById("address_to");
|
|
88
|
-
if (
|
|
89
|
-
for (const key in
|
|
91
|
+
if (shippingData && form) {
|
|
92
|
+
for (const key in shippingData) {
|
|
90
93
|
const input = form.elements[key];
|
|
91
94
|
if (input) { // Check if the form element exists
|
|
92
|
-
input.value =
|
|
95
|
+
input.value = shippingData[key].toString();
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
}
|
|
@@ -113,7 +116,7 @@ export function ShoppingCart(props) {
|
|
|
113
116
|
const formElement = document.getElementById(formID);
|
|
114
117
|
const formData = new FormData(formElement);
|
|
115
118
|
const formObject = Object.fromEntries(formData);
|
|
116
|
-
|
|
119
|
+
setShippingInfo(formObject);
|
|
117
120
|
}
|
|
118
121
|
handleOnApprove.propTypes = {
|
|
119
122
|
data: PropTypes.object.isRequired
|
|
@@ -121,9 +124,8 @@ export function ShoppingCart(props) {
|
|
|
121
124
|
function handleOnApprove(props) {
|
|
122
125
|
if (debug)
|
|
123
126
|
console.log("Handling onApprove");
|
|
124
|
-
// eslint-disable-next-line react/prop-types
|
|
125
127
|
setOrderData(props.data);
|
|
126
|
-
|
|
128
|
+
clearShoppingCart();
|
|
127
129
|
// SetProgressStep();
|
|
128
130
|
SetProgressStep("ThankYou");
|
|
129
131
|
}
|
|
@@ -144,20 +146,27 @@ export function ShoppingCart(props) {
|
|
|
144
146
|
}
|
|
145
147
|
else if (progressStep === "Checkout") {
|
|
146
148
|
// ========== CHECKOUT ==========
|
|
147
|
-
return (_jsxs("div", { className: "pixCart", children: [_jsx(CalloutHeader, { title: "Checkout Summary : " }),
|
|
149
|
+
return (_jsxs("div", { className: "pixCart", children: [_jsx(CalloutHeader, { title: "Checkout Summary : " }), checkoutData && _jsx(CheckoutItems, { ...checkoutData }), _jsx("br", {}), _jsx(FormButton, { className: "pixCartButton", type: "button", id: "backToCart", text: "<= Back To Cart", onClick: () => SetProgressStep("ShippingInfo") }), _jsx("br", {}), _jsx(PayPal, { payPalClientID: props.payPalClientID, checkoutData: getCheckoutData(), onApprove: handleOnApprove })] }));
|
|
148
150
|
}
|
|
149
151
|
else if (progressStep === "ShippingInfo") {
|
|
150
152
|
// ========== SHOPPING CART ==========
|
|
151
153
|
// ========== SHIPPING INFO ==========
|
|
152
|
-
return (_jsxs("div", { className: "pixCart", children: [_jsx(CalloutHeader, { title: "Shopping Cart : " }), paintCartItems(shoppingCart ?? []), _jsx("br", {}), _jsx("div", { children: _jsx(FormButton, { className: "pixCartButton", type: "button", id: "backToCart", text: "Clear Cart", onClick: () =>
|
|
154
|
+
return (_jsxs("div", { className: "pixCart", children: [_jsx(CalloutHeader, { title: "Shopping Cart : " }), paintCartItems(shoppingCart ?? []), _jsx("br", {}), _jsx("div", { children: _jsx(FormButton, { className: "pixCartButton", type: "button", id: "backToCart", text: "Clear Cart", onClick: () => clearShoppingCart() }) }), _jsx("br", {}), _jsx("br", {}), _jsx("hr", {}), _jsx("br", {}), _jsx("br", {}), _jsxs("div", { children: [_jsx(CalloutHeader, { title: "Shipping To : " }), _jsx(FormEngine, { name: "address_to", id: "address_to", formData: shippingToData, onSubmitHandler: onShippingSubmit })] })] }));
|
|
153
155
|
}
|
|
154
156
|
else {
|
|
155
157
|
// ========== EMPTY SHOPPING CART ==========
|
|
156
158
|
return (_jsxs("div", { className: "pixCart", children: [_jsx(CalloutHeader, { title: "Shopping Cart : " }), _jsx("br", {}), _jsx("div", { className: "centered", children: "No items in your shopping cart" }), _jsx("div", { id: "paypal-button-container", className: "paypal-button-container" })] }));
|
|
157
159
|
}
|
|
158
160
|
}
|
|
159
|
-
ShoppingCartItem.
|
|
160
|
-
item: PropTypes.
|
|
161
|
+
ShoppingCartItem.propTypes = {
|
|
162
|
+
item: PropTypes.shape({
|
|
163
|
+
itemID: PropTypes.string.isRequired,
|
|
164
|
+
itemURL: PropTypes.string,
|
|
165
|
+
itemTitle: PropTypes.string.isRequired,
|
|
166
|
+
itemImageURL: PropTypes.string,
|
|
167
|
+
itemQuantity: PropTypes.number.isRequired,
|
|
168
|
+
itemCost: PropTypes.number.isRequired,
|
|
169
|
+
}).isRequired
|
|
161
170
|
};
|
|
162
171
|
export function ShoppingCartItem(props) {
|
|
163
172
|
const thisItem = props.item;
|
|
@@ -171,30 +180,53 @@ export function ShoppingCartItem(props) {
|
|
|
171
180
|
_jsx(SmartImage, { src: thisItem.itemImageURL, title: thisItem.itemTitle, alt: thisItem.itemTitle, cloudinaryEnv: config?.cloudinary?.product_env, cloudinaryDomain: config?.cloudinary?.baseUrl, cloudinaryTransforms: config?.cloudinary?.transforms }))
|
|
172
181
|
: _jsx(_Fragment, {}) }), _jsxs("div", { className: "grid-s4-e11", children: [_jsx("div", { className: "pixCartItemHeader", children: _jsx("span", { children: thisItem.itemURL
|
|
173
182
|
? _jsx("a", { href: thisItem.itemURL, target: thisItemTarget, rel: "noopener noreferrer", children: _jsx("h2", { className: "", children: thisItem.itemTitle }) })
|
|
174
|
-
: _jsx("h2", { className: "", children: thisItem.itemTitle }) }) }), _jsxs("div", { className: "pixCartItemDetails grid12", children: [_jsx("br", {}), _jsxs("div", { children: [_jsx("b", { children: "Item ID: " }), thisItem.itemID] }), _jsxs("div", { children: [_jsx("b", { children: "Quantity: " }), thisItem.itemQuantity] }), _jsx("br", {}), _jsx("div", { children: _jsx(FormButton, { className: "pixCartButton", type: "button", id: `btn-rm-${thisItem.itemID}`, text: "Remove Item From Cart", onClick: () =>
|
|
183
|
+
: _jsx("h2", { className: "", children: thisItem.itemTitle }) }) }), _jsxs("div", { className: "pixCartItemDetails grid12", children: [_jsx("br", {}), _jsxs("div", { children: [_jsx("b", { children: "Item ID: " }), thisItem.itemID] }), _jsxs("div", { children: [_jsx("b", { children: "Quantity: " }), thisItem.itemQuantity] }), _jsx("br", {}), _jsx("div", { children: _jsx(FormButton, { className: "pixCartButton", type: "button", id: `btn-rm-${thisItem.itemID}`, text: "Remove Item From Cart", onClick: () => removeFromShoppingCart(thisItem) }) })] })] }), _jsx("div", { className: "grid-s11-e13", children: _jsx("div", { className: "pixCartItemPrice", children: formatAsUSD(thisItem.itemCost) }) })] }));
|
|
175
184
|
}
|
|
185
|
+
CheckoutItems.propTypes = {
|
|
186
|
+
items: PropTypes.arrayOf(PropTypes.shape({
|
|
187
|
+
itemID: PropTypes.string.isRequired,
|
|
188
|
+
itemURL: PropTypes.string,
|
|
189
|
+
itemTitle: PropTypes.string.isRequired,
|
|
190
|
+
itemImageURL: PropTypes.string,
|
|
191
|
+
itemQuantity: PropTypes.number.isRequired,
|
|
192
|
+
itemCost: PropTypes.number.isRequired,
|
|
193
|
+
})).isRequired,
|
|
194
|
+
shippingTo: PropTypes.shape({
|
|
195
|
+
name: PropTypes.string.isRequired,
|
|
196
|
+
street1: PropTypes.string.isRequired,
|
|
197
|
+
city: PropTypes.string.isRequired,
|
|
198
|
+
state: PropTypes.string.isRequired,
|
|
199
|
+
zip: PropTypes.string.isRequired,
|
|
200
|
+
}).isRequired,
|
|
201
|
+
subtotal_discount: PropTypes.number.isRequired,
|
|
202
|
+
subtotal: PropTypes.number.isRequired,
|
|
203
|
+
shippingCost: PropTypes.number.isRequired,
|
|
204
|
+
handlingFee: PropTypes.number.isRequired,
|
|
205
|
+
salesTax: PropTypes.number.isRequired,
|
|
206
|
+
total: PropTypes.number.isRequired,
|
|
207
|
+
};
|
|
176
208
|
export function CheckoutItems(props) {
|
|
177
|
-
const
|
|
178
|
-
const to =
|
|
209
|
+
const { items, shippingTo, subtotal_discount, subtotal, shippingCost, handlingFee, salesTax, total } = props;
|
|
210
|
+
const to = shippingTo;
|
|
179
211
|
const addr = _jsxs(_Fragment, { children: [_jsx("div", { children: to.name }), _jsx("div", { children: to.street1 }), _jsxs("div", { children: [to.city, ", ", to.state, " ", to.zip] })] });
|
|
180
212
|
let checkoutTableData = [{
|
|
181
213
|
"Name": "Shopping Cart Items : ",
|
|
182
214
|
"Value": items,
|
|
183
215
|
}, {
|
|
184
216
|
"Name": "Subtotal Discount : ",
|
|
185
|
-
"Value": formatAsUSD(
|
|
217
|
+
"Value": formatAsUSD(subtotal_discount),
|
|
186
218
|
}, {
|
|
187
219
|
"Name": "Subtotal : ",
|
|
188
|
-
"Value": formatAsUSD(
|
|
220
|
+
"Value": formatAsUSD(subtotal),
|
|
189
221
|
}, {
|
|
190
222
|
"Name": "Shipping Address : ",
|
|
191
223
|
"Value": addr,
|
|
192
224
|
}, {
|
|
193
225
|
"Name": "Shipping Cost : ",
|
|
194
|
-
"Value": formatAsUSD(
|
|
226
|
+
"Value": formatAsUSD(shippingCost),
|
|
195
227
|
}, {
|
|
196
228
|
"Name": "Handling Fee : ",
|
|
197
|
-
"Value": formatAsUSD(
|
|
229
|
+
"Value": formatAsUSD(handlingFee),
|
|
198
230
|
}, /* {
|
|
199
231
|
"Name": "Insurance Cost : ",
|
|
200
232
|
"Value": formatAsUSD(checkoutData.insuranceCost ?? 0),
|
|
@@ -204,16 +236,19 @@ export function CheckoutItems(props) {
|
|
|
204
236
|
}, */
|
|
205
237
|
{
|
|
206
238
|
"Name": "Sales Tax : ",
|
|
207
|
-
"Value": formatAsUSD(
|
|
239
|
+
"Value": formatAsUSD(salesTax),
|
|
208
240
|
}, {
|
|
209
241
|
"Name": "TOTAL : ",
|
|
210
|
-
"Value": formatAsUSD(
|
|
242
|
+
"Value": formatAsUSD(total),
|
|
211
243
|
}];
|
|
212
|
-
if (
|
|
244
|
+
if (subtotal_discount == 0) {
|
|
213
245
|
checkoutTableData = checkoutTableData.filter(obj => obj.Name !== "Subtotal Discount : ");
|
|
214
246
|
}
|
|
215
247
|
return (_jsx(Table, { id: "pixCheckout", data: checkoutTableData }));
|
|
216
248
|
}
|
|
249
|
+
CartButton.propTypes = {
|
|
250
|
+
href: PropTypes.string.isRequired,
|
|
251
|
+
};
|
|
217
252
|
export function CartButton(props) {
|
|
218
253
|
const config = usePixelatedConfig();
|
|
219
254
|
const [cartCount, setCartCount] = useState(0);
|
|
@@ -238,9 +273,18 @@ export function CartButton(props) {
|
|
|
238
273
|
}, [cartCount]);
|
|
239
274
|
return (_jsx("div", { className: "pixCart", children: _jsxs("button", { className: "pixCartButton", type: "button", id: "pixCartButton", onClick: () => window.location.href = props.href, children: [_jsx(SmartImage, { src: "/images/icons/cart-icon.png", title: "View Shopping Cart", alt: "View Shopping Cart", cloudinaryEnv: config?.cloudinary?.product_env, cloudinaryDomain: config?.cloudinary?.baseUrl, cloudinaryTransforms: config?.cloudinary?.transforms }), _jsxs("span", { children: ["\u00A0", `(${cartCount})`] })] }) }));
|
|
240
275
|
}
|
|
276
|
+
ViewItemDetails.propTypes = {
|
|
277
|
+
href: PropTypes.string.isRequired,
|
|
278
|
+
itemID: PropTypes.string.isRequired,
|
|
279
|
+
};
|
|
241
280
|
export function ViewItemDetails(props) {
|
|
242
281
|
return (_jsx("div", { children: _jsx(FormButton, { className: "pixCartButton", type: "button", id: `btn-item-${props.itemID}`, text: "View Item Details", onClick: () => window.location.href = `${props.href}/${props.itemID}` }) }));
|
|
243
282
|
}
|
|
283
|
+
AddToCartButton.propTypes = {
|
|
284
|
+
handler: PropTypes.func.isRequired,
|
|
285
|
+
item: PropTypes.object.isRequired,
|
|
286
|
+
itemID: PropTypes.string.isRequired,
|
|
287
|
+
};
|
|
244
288
|
export function AddToCartButton(props) {
|
|
245
289
|
const [modalContent, setModalContent] = useState();
|
|
246
290
|
useEffect(() => {
|
|
@@ -251,8 +295,12 @@ export function AddToCartButton(props) {
|
|
|
251
295
|
props.handler(props.item);
|
|
252
296
|
handleModalOpen(e.nativeEvent, "-" + props.itemID);
|
|
253
297
|
}
|
|
254
|
-
return (_jsxs("div", { children: [_jsx(FormButton, { className: "pixCartButton", type: "button", id: `btn-add-${props.itemID}`, text: "Add to Shopping Cart", onClick: (e) => handleClick(e) }), _jsx(Modal, { modalContent: modalContent, modalID: "-" + props.itemID })] }));
|
|
298
|
+
return (_jsxs("div", { children: [_jsx(FormButton, { className: "pixCartButton", type: "button", id: `btn-add-${props.itemID}`, text: "Add to Shopping Cart", onClick: (e) => handleClick(e) }), modalContent && _jsx(Modal, { modalContent: modalContent, modalID: "-" + props.itemID })] }));
|
|
255
299
|
}
|
|
300
|
+
GoToCartButton.propTypes = {
|
|
301
|
+
href: PropTypes.string.isRequired,
|
|
302
|
+
itemID: PropTypes.string.isRequired,
|
|
303
|
+
};
|
|
256
304
|
export function GoToCartButton(props) {
|
|
257
305
|
return (_jsx("div", { children: _jsx(FormButton, { className: "pixCartButton", type: "button", id: `btn-cart-${props.itemID}`, text: "Go to Shopping Cart", onClick: () => window.location.href = props.href }) }));
|
|
258
306
|
}
|
|
@@ -127,7 +127,7 @@ export function getCartSubTotal(cart) {
|
|
|
127
127
|
}
|
|
128
128
|
return formatAsHundredths(cartSubTotal);
|
|
129
129
|
}
|
|
130
|
-
export function
|
|
130
|
+
export function addToShoppingCart(thisItem) {
|
|
131
131
|
let cart = getCart();
|
|
132
132
|
if (alreadyInCart(cart, thisItem.itemID)) {
|
|
133
133
|
const index = getIndexInCart(cart, thisItem.itemID);
|
|
@@ -153,7 +153,7 @@ export function AddToShoppingCart(thisItem) {
|
|
|
153
153
|
localStorage.setItem(shoppingCartKey, JSON.stringify(cart));
|
|
154
154
|
window.dispatchEvent(new Event('storage'));
|
|
155
155
|
}
|
|
156
|
-
export function
|
|
156
|
+
export function removeFromShoppingCart(thisItem) {
|
|
157
157
|
let cart = getCart();
|
|
158
158
|
if (alreadyInCart(cart, thisItem.itemID)) {
|
|
159
159
|
cart.splice(getIndexInCart(cart, thisItem.itemID), 1);
|
|
@@ -161,7 +161,7 @@ export function RemoveFromShoppingCart(thisItem) {
|
|
|
161
161
|
localStorage.setItem(shoppingCartKey, JSON.stringify(cart));
|
|
162
162
|
window.dispatchEvent(new Event('storage'));
|
|
163
163
|
}
|
|
164
|
-
export function
|
|
164
|
+
export function clearShoppingCart() {
|
|
165
165
|
localStorage.removeItem(shoppingCartKey);
|
|
166
166
|
localStorage.removeItem(shippingInfoKey);
|
|
167
167
|
window.dispatchEvent(new Event('storage'));
|
|
@@ -171,7 +171,7 @@ export function getShippingInfo() {
|
|
|
171
171
|
const ship = localStorage.getItem(shippingInfoKey);
|
|
172
172
|
return ship ? JSON.parse(ship) : [];
|
|
173
173
|
}
|
|
174
|
-
export function
|
|
174
|
+
export function setShippingInfo(shippingFormData) {
|
|
175
175
|
localStorage.setItem(shippingInfoKey, JSON.stringify(shippingFormData));
|
|
176
176
|
window.dispatchEvent(new Event('storage'));
|
|
177
177
|
}
|
|
@@ -3,7 +3,16 @@ import { useState, useEffect } from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { FontSelector } from './FontSelector';
|
|
5
5
|
import './CompoundFontSelector.css';
|
|
6
|
-
|
|
6
|
+
CompoundFontSelector.propTypes = {
|
|
7
|
+
id: PropTypes.string.isRequired,
|
|
8
|
+
name: PropTypes.string.isRequired,
|
|
9
|
+
label: PropTypes.string.isRequired,
|
|
10
|
+
required: PropTypes.bool,
|
|
11
|
+
value: PropTypes.string,
|
|
12
|
+
onChange: PropTypes.func,
|
|
13
|
+
};
|
|
14
|
+
export function CompoundFontSelector(props) {
|
|
15
|
+
const { id, name, label, required = false, value = '', onChange } = props;
|
|
7
16
|
// Parse the compound value into primary, fallback, generic parts
|
|
8
17
|
const parseCompoundValue = (val) => {
|
|
9
18
|
const parts = val.split(',').map(s => s.trim());
|
|
@@ -13,10 +22,10 @@ export function CompoundFontSelector({ id, name, label, required = false, value
|
|
|
13
22
|
generic: parts[2] || ''
|
|
14
23
|
};
|
|
15
24
|
};
|
|
16
|
-
const [fonts, setFonts] = useState(parseCompoundValue(value));
|
|
25
|
+
const [fonts, setFonts] = useState(parseCompoundValue(value || ''));
|
|
17
26
|
// Update fonts when value changes externally
|
|
18
27
|
useEffect(() => {
|
|
19
|
-
setFonts(parseCompoundValue(value));
|
|
28
|
+
setFonts(parseCompoundValue(value || ''));
|
|
20
29
|
}, [value]);
|
|
21
30
|
// Combine fonts into a single font stack value
|
|
22
31
|
const combineFonts = (fontParts) => {
|
|
@@ -29,7 +38,7 @@ export function CompoundFontSelector({ id, name, label, required = false, value
|
|
|
29
38
|
const combinedValue = combineFonts(updatedFonts);
|
|
30
39
|
onChange?.(combinedValue);
|
|
31
40
|
};
|
|
32
|
-
return (_jsxs("div", { className: "compound-font-selector", children: [_jsx("label", { children: label }), _jsxs("div", { className: "compound-container", children: [_jsx(FontSelector, { id: `${id}-primary`, name: `${name}-primary`, label: "Primary Font", fontType: "google", required: required, placeholder: "Select Google Font", value: fonts.primary, onChange: (val) => handleFontChange('primary', val) }), _jsx(FontSelector, { id: `${id}-fallback`, name: `${name}-fallback`, label: "Fallback Font", fontType: "websafe", required: false, placeholder: "Select web-safe font", value: fonts.fallback, onChange: (val) => handleFontChange('fallback', val) }), _jsx(FontSelector, { id: `${id}-generic`, name: `${name}-generic`, label: "Generic Family", fontType: "generic", required: false, placeholder: "Select generic family", value: fonts.generic, onChange: (val) => handleFontChange('generic', val) })] })] }));
|
|
41
|
+
return (_jsxs("div", { className: "compound-font-selector", children: [_jsx("label", { children: label }), _jsxs("div", { className: "compound-container", children: [_jsx(FontSelector, { id: `${id}-primary`, name: `${name}-primary`, label: "Primary Font", fontType: "google", required: !!required, placeholder: "Select Google Font", value: fonts.primary, onChange: (val) => handleFontChange('primary', val) }), _jsx(FontSelector, { id: `${id}-fallback`, name: `${name}-fallback`, label: "Fallback Font", fontType: "websafe", required: false, placeholder: "Select web-safe font", value: fonts.fallback, onChange: (val) => handleFontChange('fallback', val) }), _jsx(FontSelector, { id: `${id}-generic`, name: `${name}-generic`, label: "Generic Family", fontType: "generic", required: false, placeholder: "Select generic family", value: fonts.generic, onChange: (val) => handleFontChange('generic', val) })] })] }));
|
|
33
42
|
}
|
|
34
43
|
CompoundFontSelector.propTypes = {
|
|
35
44
|
id: PropTypes.string.isRequired,
|