@pixelated-tech/components 3.8.0 â 3.9.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 +7 -0
- package/dist/components/admin/site-health/site-health-axe-core.integration.js +135 -20
- package/dist/components/admin/site-health/site-health-axe-core.integration.test.js +79 -0
- package/dist/components/admin/site-health/site-health-axe-core.js +35 -0
- package/dist/components/admin/site-health/site-health-core-web-vitals.integration.js +5 -3
- package/dist/components/admin/site-health/site-health-core-web-vitals.integration.test.js +33 -0
- package/dist/components/admin/site-health/site-health-template.js +3 -1
- package/dist/components/admin/site-health/site-health-utils.js +22 -0
- package/dist/components/config/config.example.js +2 -0
- package/dist/components/config/config.types.js +1 -3
- package/dist/components/config/config.utils.js +13 -5
- package/dist/components/config/config.validators.js +67 -0
- package/dist/components/general/cache-manager.js +124 -0
- package/dist/components/general/google.reviews.components.js +1 -2
- package/dist/components/general/googlemap.js +5 -2
- package/dist/components/general/metadata.functions.js +15 -1
- package/dist/components/general/proxy-csp-listener.js +20 -0
- package/dist/components/general/proxy-handler.js +4 -2
- package/dist/components/general/sitemap.js +9 -16
- package/dist/components/shoppingcart/ebay.components.js +123 -15
- package/dist/components/shoppingcart/ebay.functions.js +136 -34
- package/dist/components/shoppingcart/shoppingcart.components.js +4 -2
- package/dist/components/sitebuilder/config/ConfigEngine.js +5 -2
- package/dist/components/sitebuilder/config/google-fonts.js +5 -3
- package/dist/components/sitebuilder/page/lib/pageStorageLocal.js +2 -1
- package/dist/config/pixelated.config.json +83 -69
- package/dist/index.adminclient.js +1 -0
- package/dist/index.js +3 -0
- package/dist/index.server.js +1 -0
- package/dist/scripts/release.sh +2 -2
- package/dist/test/config.mock.js +13 -0
- package/dist/test/setup.js +46 -0
- package/dist/test/test-utils.js +23 -0
- 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-axe-core.integration.d.ts +2 -0
- package/dist/types/components/admin/site-health/site-health-axe-core.integration.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-axe-core.integration.test.d.ts +2 -0
- package/dist/types/components/admin/site-health/site-health-axe-core.integration.test.d.ts.map +1 -0
- package/dist/types/components/admin/site-health/site-health-core-web-vitals.integration.d.ts +1 -0
- package/dist/types/components/admin/site-health/site-health-core-web-vitals.integration.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-core-web-vitals.integration.test.d.ts +2 -0
- package/dist/types/components/admin/site-health/site-health-core-web-vitals.integration.test.d.ts.map +1 -0
- package/dist/types/components/admin/site-health/site-health-template.d.ts.map +1 -1
- package/dist/types/components/admin/site-health/site-health-utils.d.ts +1 -1
- package/dist/types/components/admin/site-health/site-health-utils.d.ts.map +1 -1
- package/dist/types/components/config/config.example.d.ts.map +1 -1
- package/dist/types/components/config/config.types.d.ts +30 -11
- package/dist/types/components/config/config.types.d.ts.map +1 -1
- package/dist/types/components/config/config.utils.d.ts.map +1 -1
- package/dist/types/components/config/config.validators.d.ts +17 -0
- package/dist/types/components/config/config.validators.d.ts.map +1 -0
- package/dist/types/components/general/cache-manager.d.ts +45 -0
- package/dist/types/components/general/cache-manager.d.ts.map +1 -0
- package/dist/types/components/general/google.reviews.components.d.ts.map +1 -1
- package/dist/types/components/general/googlemap.d.ts +1 -1
- package/dist/types/components/general/googlemap.d.ts.map +1 -1
- package/dist/types/components/general/metadata.functions.d.ts +2 -8
- package/dist/types/components/general/metadata.functions.d.ts.map +1 -1
- package/dist/types/components/general/proxy-csp-listener.d.ts +15 -0
- package/dist/types/components/general/proxy-csp-listener.d.ts.map +1 -0
- package/dist/types/components/general/proxy-handler.d.ts.map +1 -1
- package/dist/types/components/general/schema-localbusiness.d.ts.map +1 -1
- package/dist/types/components/general/schema-website.d.ts.map +1 -1
- package/dist/types/components/general/sitemap.d.ts.map +1 -1
- package/dist/types/components/shoppingcart/ebay.components.d.ts +9 -0
- package/dist/types/components/shoppingcart/ebay.components.d.ts.map +1 -1
- package/dist/types/components/shoppingcart/ebay.functions.d.ts +20 -21
- package/dist/types/components/shoppingcart/ebay.functions.d.ts.map +1 -1
- package/dist/types/components/shoppingcart/shoppingcart.components.d.ts +1 -1
- package/dist/types/components/shoppingcart/shoppingcart.components.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/config/ConfigBuilder.d.ts +135 -0
- package/dist/types/components/sitebuilder/config/ConfigBuilder.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/config/ConfigEngine.d.ts +3 -2
- package/dist/types/components/sitebuilder/config/ConfigEngine.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/config/google-fonts.d.ts +1 -1
- package/dist/types/components/sitebuilder/config/google-fonts.d.ts.map +1 -1
- package/dist/types/components/sitebuilder/page/lib/pageStorageLocal.d.ts.map +1 -1
- package/dist/types/index.adminclient.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.server.d.ts +1 -0
- package/dist/types/stories/{seo/seo.404.stories.d.ts â general/404.stories.d.ts} +1 -2
- package/dist/types/stories/general/404.stories.d.ts.map +1 -0
- package/dist/types/stories/general/accordion.stories.d.ts +3 -3
- package/dist/types/stories/general/accordion.stories.d.ts.map +1 -1
- package/dist/types/stories/general/buzzword-bingo.stories.d.ts.map +1 -0
- package/dist/types/stories/{callout â general}/callout.many.stories.d.ts +0 -1
- package/dist/types/stories/general/callout.many.stories.d.ts.map +1 -0
- package/dist/types/stories/{callout â general}/callout.stories.d.ts +0 -1
- package/dist/types/stories/general/callout.stories.d.ts.map +1 -0
- package/dist/types/stories/general/carousel-hero.stories.d.ts +14 -0
- package/dist/types/stories/general/carousel-hero.stories.d.ts.map +1 -0
- package/dist/types/stories/{carousel â general}/carousel-reviews.stories.d.ts +0 -1
- package/dist/types/stories/general/carousel-reviews.stories.d.ts.map +1 -0
- package/dist/types/stories/general/carousel-workportfolio.stories.d.ts +14 -0
- package/dist/types/stories/general/carousel-workportfolio.stories.d.ts.map +1 -0
- package/dist/types/stories/{carousel â general}/carousel.stories.d.ts +1 -9
- package/dist/types/stories/general/carousel.stories.d.ts.map +1 -0
- package/dist/types/stories/general/contentful.item.stories.d.ts +12 -0
- package/dist/types/stories/general/contentful.item.stories.d.ts.map +1 -0
- package/dist/types/stories/general/contentful.items.stories.d.ts +10 -0
- package/dist/types/stories/general/contentful.items.stories.d.ts.map +1 -0
- package/dist/types/stories/{cms â general}/contentful.stories.d.ts +0 -1
- package/dist/types/stories/general/contentful.stories.d.ts.map +1 -0
- package/dist/types/stories/{seo/seo.faq-accordion.stories.d.ts â general/faq-accordion.stories.d.ts} +1 -1
- package/dist/types/stories/general/faq-accordion.stories.d.ts.map +1 -0
- package/dist/types/stories/{cms â general}/google.reviews.stories.d.ts +1 -2
- package/dist/types/stories/general/google.reviews.stories.d.ts.map +1 -0
- package/dist/types/stories/{seo/seo.googleanalytics.stories.d.ts â general/googleanalytics.stories.d.ts} +2 -4
- package/dist/types/stories/general/googleanalytics.stories.d.ts.map +1 -0
- package/dist/types/stories/{seo/seo.googlesearch.stories.d.ts â general/googlesearch.stories.d.ts} +1 -1
- package/dist/types/stories/general/googlesearch.stories.d.ts.map +1 -0
- package/dist/types/stories/{cms â general}/gravatar.stories.d.ts +0 -1
- package/dist/types/stories/general/gravatar.stories.d.ts.map +1 -0
- package/dist/types/stories/general/headers.stories.d.ts.map +1 -1
- package/dist/types/stories/{cms â general}/instagram.stories.d.ts +2 -2
- package/dist/types/stories/general/instagram.stories.d.ts.map +1 -0
- package/dist/types/stories/general/layout.stories.d.ts +9 -9
- package/dist/types/stories/{structured â general}/markdown.stories.d.ts +1 -2
- package/dist/types/stories/general/markdown.stories.d.ts.map +1 -0
- package/dist/types/stories/{menu â general}/menu-accordion.stories.d.ts +2 -2
- package/dist/types/stories/general/menu-accordion.stories.d.ts.map +1 -0
- package/dist/types/stories/{menu â general}/menu-expando.stories.d.ts +1 -1
- package/dist/types/stories/general/menu-expando.stories.d.ts.map +1 -0
- package/dist/types/stories/{menu â general}/menu-simple.stories.d.ts +1 -1
- package/dist/types/stories/general/menu-simple.stories.d.ts.map +1 -0
- package/dist/types/stories/{seo/seo.metadata.stories.d.ts â general/metadata.stories.d.ts} +1 -1
- package/dist/types/stories/general/metadata.stories.d.ts.map +1 -0
- package/dist/types/stories/general/microinteractions.stories.d.ts +0 -1
- package/dist/types/stories/general/microinteractions.stories.d.ts.map +1 -1
- package/dist/types/stories/general/modal.stories.d.ts +0 -1
- package/dist/types/stories/general/modal.stories.d.ts.map +1 -1
- package/dist/types/stories/general/nerdjoke.stories.d.ts.map +1 -0
- package/dist/types/stories/{structured â general}/recipe.stories.d.ts +1 -2
- package/dist/types/stories/general/recipe.stories.d.ts.map +1 -0
- package/dist/types/stories/{structured â general}/resume.stories.d.ts +1 -2
- package/dist/types/stories/{structured â general}/resume.stories.d.ts.map +1 -1
- package/dist/types/stories/{seo/seo.schema.stories.d.ts â general/schema.stories.d.ts} +1 -2
- package/dist/types/stories/general/schema.stories.d.ts.map +1 -0
- package/dist/types/stories/{seo/seo.sitemap.stories.d.ts â general/sitemap.stories.d.ts} +1 -1
- package/dist/types/stories/general/sitemap.stories.d.ts.map +1 -0
- package/dist/types/stories/general/smartimage.stories.d.ts.map +1 -1
- package/dist/types/stories/{structured â general}/socialcard.stories.d.ts +0 -1
- package/dist/types/stories/general/socialcard.stories.d.ts.map +1 -0
- package/dist/types/stories/general/splitscroll.stories.d.ts.map +1 -1
- package/dist/types/stories/{carousel â general}/tiles.stories.d.ts +0 -1
- package/dist/types/stories/general/tiles.stories.d.ts.map +1 -0
- package/dist/types/stories/{structured â general}/timeline.stories.d.ts +0 -1
- package/dist/types/stories/general/timeline.stories.d.ts.map +1 -0
- package/dist/types/stories/{cms â general}/wordpress.stories.d.ts +6 -2
- package/dist/types/stories/general/wordpress.stories.d.ts.map +1 -0
- package/dist/types/stories/shoppingcart/ebay.stories.d.ts +16 -0
- package/dist/types/stories/shoppingcart/ebay.stories.d.ts.map +1 -0
- package/dist/types/stories/shoppingcart/shoppingcart.ebay.item.stories.d.ts +1 -12
- package/dist/types/stories/shoppingcart/shoppingcart.ebay.item.stories.d.ts.map +1 -1
- package/dist/types/stories/shoppingcart/shoppingcart.ebay.items.stories.d.ts +1 -12
- package/dist/types/stories/shoppingcart/shoppingcart.ebay.items.stories.d.ts.map +1 -1
- package/dist/types/stories/shoppingcart/shoppingcart.stories.d.ts.map +1 -1
- package/dist/types/stories/sitebuilder/compoundfontselector.stories.d.ts +13 -35
- package/dist/types/stories/sitebuilder/compoundfontselector.stories.d.ts.map +1 -1
- package/dist/types/stories/sitebuilder/form-engine.stories.d.ts +0 -1
- package/dist/types/stories/sitebuilder/form-engine.stories.d.ts.map +1 -1
- package/dist/types/stories/sitebuilder/pageengine.stories.d.ts +0 -1
- package/dist/types/stories/sitebuilder/pageengine.stories.d.ts.map +1 -1
- package/dist/types/test/config.mock.d.ts +11 -0
- package/dist/types/test/config.mock.d.ts.map +1 -0
- package/dist/types/test/setup.d.ts.map +1 -0
- package/dist/types/test/test-utils.d.ts +87 -0
- package/dist/types/test/test-utils.d.ts.map +1 -0
- package/dist/types/tests/cache-manager.test.d.ts +2 -0
- package/dist/types/tests/cache-manager.test.d.ts.map +1 -0
- package/dist/types/tests/config-core.test.d.ts +2 -0
- package/dist/types/tests/config-core.test.d.ts.map +1 -0
- package/dist/types/tests/config.validators.test.d.ts +2 -0
- package/dist/types/tests/config.validators.test.d.ts.map +1 -0
- package/dist/types/tests/ebay-functions.test.d.ts +2 -0
- package/dist/types/tests/ebay-functions.test.d.ts.map +1 -0
- package/dist/types/tests/site-health-utils.test.d.ts +2 -0
- package/dist/types/tests/site-health-utils.test.d.ts.map +1 -0
- package/package.json +7 -7
- package/dist/types/stories/callout/callout.many.stories.d.ts.map +0 -1
- package/dist/types/stories/callout/callout.stories.d.ts.map +0 -1
- package/dist/types/stories/carousel/carousel-hero.stories.d.ts +0 -22
- package/dist/types/stories/carousel/carousel-hero.stories.d.ts.map +0 -1
- package/dist/types/stories/carousel/carousel-reviews.stories.d.ts.map +0 -1
- package/dist/types/stories/carousel/carousel-workportfolio.stories.d.ts +0 -22
- package/dist/types/stories/carousel/carousel-workportfolio.stories.d.ts.map +0 -1
- package/dist/types/stories/carousel/carousel.stories.d.ts.map +0 -1
- package/dist/types/stories/carousel/tiles.stories.d.ts.map +0 -1
- package/dist/types/stories/cms/contentful.item.stories.d.ts +0 -21
- package/dist/types/stories/cms/contentful.item.stories.d.ts.map +0 -1
- package/dist/types/stories/cms/contentful.items.stories.d.ts +0 -20
- package/dist/types/stories/cms/contentful.items.stories.d.ts.map +0 -1
- package/dist/types/stories/cms/contentful.stories.d.ts.map +0 -1
- package/dist/types/stories/cms/google.reviews.stories.d.ts.map +0 -1
- package/dist/types/stories/cms/gravatar.stories.d.ts.map +0 -1
- package/dist/types/stories/cms/instagram.stories.d.ts.map +0 -1
- package/dist/types/stories/cms/wordpress.stories.d.ts.map +0 -1
- package/dist/types/stories/menu/menu-accordion.stories.d.ts.map +0 -1
- package/dist/types/stories/menu/menu-expando.stories.d.ts.map +0 -1
- package/dist/types/stories/menu/menu-simple.stories.d.ts.map +0 -1
- package/dist/types/stories/nerdjoke.stories.d.ts.map +0 -1
- package/dist/types/stories/seo/seo.404.stories.d.ts.map +0 -1
- package/dist/types/stories/seo/seo.faq-accordion.stories.d.ts.map +0 -1
- package/dist/types/stories/seo/seo.googleanalytics.stories.d.ts.map +0 -1
- package/dist/types/stories/seo/seo.googlesearch.stories.d.ts.map +0 -1
- package/dist/types/stories/seo/seo.metadata.stories.d.ts.map +0 -1
- package/dist/types/stories/seo/seo.schema.stories.d.ts.map +0 -1
- package/dist/types/stories/seo/seo.sitemap.stories.d.ts.map +0 -1
- package/dist/types/stories/structured/buzzword-bingo.stories.d.ts.map +0 -1
- package/dist/types/stories/structured/markdown.stories.d.ts.map +0 -1
- package/dist/types/stories/structured/recipe.stories.d.ts.map +0 -1
- package/dist/types/stories/structured/socialcard.stories.d.ts.map +0 -1
- package/dist/types/stories/structured/timeline.stories.d.ts.map +0 -1
- package/dist/types/tests/setup.d.ts.map +0 -1
- /package/dist/types/stories/{structured â general}/buzzword-bingo.stories.d.ts +0 -0
- /package/dist/types/stories/{nerdjoke.stories.d.ts â general/nerdjoke.stories.d.ts} +0 -0
- /package/dist/types/{tests â test}/setup.d.ts +0 -0
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import PropTypes from "prop-types";
|
|
2
2
|
import { getCloudinaryRemoteFetchURL as getImg } from "../general/cloudinary";
|
|
3
|
+
import { CacheManager } from "../general/cache-manager";
|
|
3
4
|
const debug = false;
|
|
5
|
+
// Initialize eBay Cache (Session storage, 1 hour TTL)
|
|
6
|
+
const ebayCache = new CacheManager({
|
|
7
|
+
mode: 'session',
|
|
8
|
+
prefix: 'ebay_',
|
|
9
|
+
ttl: 60 * 60 * 1000
|
|
10
|
+
});
|
|
4
11
|
/* ===== EBAY BROWSE API DOCUMENTATION =====
|
|
5
12
|
https://developer.ebay.com/api-docs/buy/browse/resources/item_summary/methods/search
|
|
6
13
|
https://developer.ebay.com/api-docs/buy/static/ref-buy-browse-filters.html
|
|
@@ -8,21 +15,55 @@ https://developer.ebay.com/api-docs/static/oauth-ui-tokens.html
|
|
|
8
15
|
https://developer.ebay.com/my/keys
|
|
9
16
|
https://developer.ebay.com/my/auth?env=production&index=0
|
|
10
17
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Merges provided props with server-side config if available.
|
|
20
|
+
* This ensures functions work out-of-the-box on the server without manual prop passing.
|
|
21
|
+
*/
|
|
22
|
+
function getMergedEbayConfig(providedApiProps) {
|
|
23
|
+
let apiProps = {
|
|
24
|
+
proxyURL: '',
|
|
25
|
+
baseTokenURL: '',
|
|
26
|
+
baseSearchURL: '',
|
|
27
|
+
qsSearchURL: '',
|
|
28
|
+
baseItemURL: '',
|
|
29
|
+
qsItemURL: '',
|
|
30
|
+
baseAnalyticsURL: '',
|
|
31
|
+
...providedApiProps
|
|
32
|
+
};
|
|
33
|
+
if (typeof window === 'undefined') {
|
|
34
|
+
try {
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
36
|
+
const { getFullPixelatedConfig } = require('../config/config');
|
|
37
|
+
const config = getFullPixelatedConfig();
|
|
38
|
+
if (config) {
|
|
39
|
+
apiProps = {
|
|
40
|
+
proxyURL: config.global?.proxyUrl || '',
|
|
41
|
+
...apiProps,
|
|
42
|
+
...(config.ebay || {}),
|
|
43
|
+
...providedApiProps
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
// Fail-silent, use what we have
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return apiProps;
|
|
52
|
+
}
|
|
15
53
|
getShoppingCartItem.propTypes = {
|
|
16
54
|
thisItem: PropTypes.any.isRequired,
|
|
17
55
|
cloudinaryProductEnv: PropTypes.string,
|
|
56
|
+
apiProps: PropTypes.any,
|
|
18
57
|
};
|
|
19
58
|
export function getShoppingCartItem(props) {
|
|
20
59
|
let qty = 0;
|
|
21
60
|
const thisItem = props.thisItem;
|
|
22
|
-
|
|
61
|
+
const apiProps = props.apiProps;
|
|
62
|
+
const itemCategory = apiProps?.itemCategory;
|
|
63
|
+
if (thisItem.categoryId && thisItem.categoryId == itemCategory) {
|
|
23
64
|
qty = 1;
|
|
24
65
|
}
|
|
25
|
-
else if (thisItem.categories[0]
|
|
66
|
+
else if (thisItem.categories?.[0]?.categoryId && thisItem.categories[0].categoryId == itemCategory) {
|
|
26
67
|
qty = 1;
|
|
27
68
|
}
|
|
28
69
|
else {
|
|
@@ -49,26 +90,12 @@ search tokenScope: 'https://api.ebay.com/oauth/api_scope',
|
|
|
49
90
|
item tokenScope: 'https://api.ebay.com/oauth/api_scope/buy.item.bulk',
|
|
50
91
|
getItem tokenScope: 'https://api.ebay.com/oauth/api_scope',
|
|
51
92
|
*/
|
|
52
|
-
export const defaultEbayProps = {
|
|
53
|
-
proxyURL: "https://proxy.pixelated.tech/prod/proxy?url=",
|
|
54
|
-
baseTokenURL: 'https://api.ebay.com/identity/v1/oauth2/token',
|
|
55
|
-
tokenScope: 'https://api.ebay.com/oauth/api_scope',
|
|
56
|
-
baseSearchURL: 'https://api.ebay.com/buy/browse/v1/item_summary/search',
|
|
57
|
-
qsSearchURL: '?q=sunglasses&fieldgroups=full&category_ids=79720&aspect_filter=categoryId:79720&filter=sellers:{pixelatedtech}&sort=newlyListed&limit=200',
|
|
58
|
-
baseItemURL: 'https://api.ebay.com/buy/browse/v1/item',
|
|
59
|
-
qsItemURL: '/v1|295959752403|0?fieldgroups=PRODUCT,ADDITIONAL_SELLER_DETAILS',
|
|
60
|
-
appId: 'BrianWha-Pixelate-PRD-1fb4458de-1a8431fe', // clientId
|
|
61
|
-
appCertId: 'PRD-fb4458deef01-0d54-496a-b572-a04b', // clientSecret
|
|
62
|
-
sbxAppId: 'BrianWha-Pixelate-SBX-ad482b6ae-8cb8fead', // Sandbox
|
|
63
|
-
sbxAppCertId: '',
|
|
64
|
-
globalId: 'EBAY-US',
|
|
65
|
-
};
|
|
66
93
|
/* ========== GET TOKEN ========== */
|
|
67
94
|
getEbayAppToken.propTypes = {
|
|
68
95
|
apiProps: PropTypes.object.isRequired,
|
|
69
96
|
};
|
|
70
97
|
export function getEbayAppToken(props) {
|
|
71
|
-
const apiProps =
|
|
98
|
+
const apiProps = getMergedEbayConfig(props.apiProps);
|
|
72
99
|
const fetchToken = async () => {
|
|
73
100
|
if (debug)
|
|
74
101
|
console.log("Fetching Token");
|
|
@@ -105,12 +132,21 @@ getEbayBrowseSearch.propTypes = {
|
|
|
105
132
|
token: PropTypes.string.isRequired,
|
|
106
133
|
};
|
|
107
134
|
export function getEbayBrowseSearch(props) {
|
|
108
|
-
const apiProps =
|
|
135
|
+
const apiProps = getMergedEbayConfig(props.apiProps);
|
|
109
136
|
const fetchData = async (token) => {
|
|
137
|
+
const fullURL = apiProps.baseSearchURL + apiProps.qsSearchURL;
|
|
138
|
+
const cacheKey = `search_${fullURL}`;
|
|
139
|
+
// Check Cache
|
|
140
|
+
const cached = ebayCache.get(cacheKey);
|
|
141
|
+
if (cached) {
|
|
142
|
+
if (debug)
|
|
143
|
+
console.log("Returning cached eBay Search Data", cacheKey);
|
|
144
|
+
return cached;
|
|
145
|
+
}
|
|
110
146
|
if (debug)
|
|
111
147
|
console.log("Fetching ebay API Browse Search Data");
|
|
112
148
|
try {
|
|
113
|
-
const response = await fetch(apiProps.proxyURL + encodeURIComponent(
|
|
149
|
+
const response = await fetch(apiProps.proxyURL + encodeURIComponent(fullURL), {
|
|
114
150
|
method: 'GET',
|
|
115
151
|
headers: {
|
|
116
152
|
'Authorization': 'Bearer ' + token,
|
|
@@ -124,8 +160,10 @@ export function getEbayBrowseSearch(props) {
|
|
|
124
160
|
}
|
|
125
161
|
const data = await response.json();
|
|
126
162
|
if (debug)
|
|
127
|
-
console.log("Fetched eBay API Browse Search Data:",
|
|
128
|
-
|
|
163
|
+
console.log("Fetched eBay API Browse Search Data:", data);
|
|
164
|
+
// Store in Cache
|
|
165
|
+
ebayCache.set(cacheKey, data);
|
|
166
|
+
return data;
|
|
129
167
|
}
|
|
130
168
|
catch (error) {
|
|
131
169
|
console.error('Error fetching data:', error);
|
|
@@ -139,12 +177,21 @@ getEbayBrowseItem.propTypes = {
|
|
|
139
177
|
token: PropTypes.string.isRequired,
|
|
140
178
|
};
|
|
141
179
|
export function getEbayBrowseItem(props) {
|
|
142
|
-
const apiProps =
|
|
180
|
+
const apiProps = getMergedEbayConfig(props.apiProps);
|
|
143
181
|
const fetchData = async (token) => {
|
|
182
|
+
const fullURL = (apiProps.baseItemURL ?? '') + (apiProps.qsItemURL ?? '');
|
|
183
|
+
const cacheKey = `item_${fullURL}`;
|
|
184
|
+
// Check Cache
|
|
185
|
+
const cached = ebayCache.get(cacheKey);
|
|
186
|
+
if (cached) {
|
|
187
|
+
if (debug)
|
|
188
|
+
console.log("Returning cached eBay Item Data", cacheKey);
|
|
189
|
+
return cached;
|
|
190
|
+
}
|
|
144
191
|
if (debug)
|
|
145
192
|
console.log("Fetching ebay API Browse Item Data");
|
|
146
193
|
try {
|
|
147
|
-
const response = await fetch(apiProps.proxyURL + encodeURIComponent(
|
|
194
|
+
const response = await fetch(apiProps.proxyURL + encodeURIComponent(fullURL), {
|
|
148
195
|
method: 'GET',
|
|
149
196
|
headers: {
|
|
150
197
|
'Authorization': 'Bearer ' + token,
|
|
@@ -158,8 +205,10 @@ export function getEbayBrowseItem(props) {
|
|
|
158
205
|
}
|
|
159
206
|
const data = await response.json();
|
|
160
207
|
if (debug)
|
|
161
|
-
console.log("Fetched eBay Item Data:",
|
|
162
|
-
|
|
208
|
+
console.log("Fetched eBay Item Data:", data);
|
|
209
|
+
// Store in Cache
|
|
210
|
+
ebayCache.set(cacheKey, data);
|
|
211
|
+
return data;
|
|
163
212
|
}
|
|
164
213
|
catch (error) {
|
|
165
214
|
console.error('Error fetching data:', error);
|
|
@@ -167,13 +216,55 @@ export function getEbayBrowseItem(props) {
|
|
|
167
216
|
};
|
|
168
217
|
return fetchData(props.token);
|
|
169
218
|
}
|
|
219
|
+
/* ========== RATE LIMITS ========== */
|
|
220
|
+
getEbayRateLimits.propTypes = {
|
|
221
|
+
apiProps: PropTypes.object.isRequired,
|
|
222
|
+
token: PropTypes.string.isRequired,
|
|
223
|
+
};
|
|
224
|
+
export function getEbayRateLimits(props) {
|
|
225
|
+
const apiProps = getMergedEbayConfig(props.apiProps);
|
|
226
|
+
const fetchAllLimits = async (token) => {
|
|
227
|
+
if (debug)
|
|
228
|
+
console.log("Fetching all eBay API Rate Limits");
|
|
229
|
+
try {
|
|
230
|
+
const [rateLimitRes, userRateLimitRes] = await Promise.all([
|
|
231
|
+
fetch(apiProps.proxyURL + encodeURIComponent(apiProps.baseAnalyticsURL + '/rate_limit'), {
|
|
232
|
+
method: 'GET',
|
|
233
|
+
headers: { 'Authorization': 'Bearer ' + token }
|
|
234
|
+
}),
|
|
235
|
+
fetch(apiProps.proxyURL + encodeURIComponent(apiProps.baseAnalyticsURL + '/user_rate_limit'), {
|
|
236
|
+
method: 'GET',
|
|
237
|
+
headers: { 'Authorization': 'Bearer ' + token }
|
|
238
|
+
})
|
|
239
|
+
]);
|
|
240
|
+
if (!rateLimitRes.ok || !userRateLimitRes.ok) {
|
|
241
|
+
throw new Error(`HTTP error! rate_limit: ${rateLimitRes.status}, user_rate_limit: ${userRateLimitRes.status}`);
|
|
242
|
+
}
|
|
243
|
+
const [rateLimit, userRateLimit] = await Promise.all([
|
|
244
|
+
rateLimitRes.json(),
|
|
245
|
+
userRateLimitRes.json()
|
|
246
|
+
]);
|
|
247
|
+
const combinedData = {
|
|
248
|
+
rate_limit: rateLimit,
|
|
249
|
+
user_rate_limit: userRateLimit
|
|
250
|
+
};
|
|
251
|
+
if (debug)
|
|
252
|
+
console.log("Fetched Combined eBay Rate Limit Data:", combinedData);
|
|
253
|
+
return combinedData;
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
console.error('Error fetching rate limits:', error);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
return fetchAllLimits(props.token);
|
|
260
|
+
}
|
|
170
261
|
/* ========== EXPORTED FUNCTIONS ========== */
|
|
171
262
|
/* ========== GET EBAY ITEMS ========== */
|
|
172
263
|
getEbayItems.propTypes = {
|
|
173
264
|
apiProps: PropTypes.object.isRequired,
|
|
174
265
|
};
|
|
175
266
|
export async function getEbayItems(props) {
|
|
176
|
-
const apiProps =
|
|
267
|
+
const apiProps = getMergedEbayConfig(props.apiProps);
|
|
177
268
|
try {
|
|
178
269
|
const response = await getEbayAppToken({ apiProps: apiProps });
|
|
179
270
|
if (debug)
|
|
@@ -194,7 +285,7 @@ getEbayItem.propTypes = {
|
|
|
194
285
|
apiProps: PropTypes.object.isRequired,
|
|
195
286
|
};
|
|
196
287
|
export async function getEbayItem(props) {
|
|
197
|
-
const apiProps =
|
|
288
|
+
const apiProps = getMergedEbayConfig(props.apiProps);
|
|
198
289
|
try {
|
|
199
290
|
const response = await getEbayAppToken({ apiProps: apiProps });
|
|
200
291
|
if (debug)
|
|
@@ -212,12 +303,21 @@ export async function getEbayItem(props) {
|
|
|
212
303
|
}
|
|
213
304
|
/* ========== ITEM SEARCH ========== */
|
|
214
305
|
export function getEbayItemsSearch(props) {
|
|
215
|
-
const apiProps =
|
|
306
|
+
const apiProps = getMergedEbayConfig(props.apiProps);
|
|
216
307
|
const fetchData = async (token) => {
|
|
308
|
+
const fullURL = apiProps.baseSearchURL + apiProps.qsSearchURL;
|
|
309
|
+
const cacheKey = `search_${fullURL}`;
|
|
310
|
+
// Check Cache
|
|
311
|
+
const cached = ebayCache.get(cacheKey);
|
|
312
|
+
if (cached) {
|
|
313
|
+
if (debug)
|
|
314
|
+
console.log("Returning cached eBay Search Data", cacheKey);
|
|
315
|
+
return cached;
|
|
316
|
+
}
|
|
217
317
|
if (debug)
|
|
218
|
-
console.log("Fetching ebay API Data");
|
|
318
|
+
console.log("Fetching ebay API Items Search Data");
|
|
219
319
|
try {
|
|
220
|
-
const response = await fetch(apiProps.proxyURL + encodeURIComponent(
|
|
320
|
+
const response = await fetch(apiProps.proxyURL + encodeURIComponent(fullURL), {
|
|
221
321
|
method: 'GET',
|
|
222
322
|
headers: {
|
|
223
323
|
'Authorization': 'Bearer ' + token,
|
|
@@ -230,6 +330,8 @@ export function getEbayItemsSearch(props) {
|
|
|
230
330
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
231
331
|
}
|
|
232
332
|
const data = await response.json();
|
|
333
|
+
// Store in Cache
|
|
334
|
+
ebayCache.set(cacheKey, data);
|
|
233
335
|
return data;
|
|
234
336
|
}
|
|
235
337
|
catch (error) {
|
|
@@ -21,9 +21,11 @@ const debug = false;
|
|
|
21
21
|
/* ========== SHOPPING CART UI COMPONENT ========== */
|
|
22
22
|
/* ================================================ */
|
|
23
23
|
ShoppingCart.propTypes = {
|
|
24
|
-
payPalClientID: PropTypes.string
|
|
24
|
+
payPalClientID: PropTypes.string,
|
|
25
25
|
};
|
|
26
26
|
export function ShoppingCart(props) {
|
|
27
|
+
const config = usePixelatedConfig();
|
|
28
|
+
const payPalClientID = props.payPalClientID || config?.paypal?.payPalApiKey || config?.paypal?.sandboxPayPalApiKey;
|
|
27
29
|
const [shoppingCart, setShoppingCart] = useState();
|
|
28
30
|
const [shippingData, setShippingData] = useState();
|
|
29
31
|
const [checkoutData, setcheckoutData] = useState();
|
|
@@ -146,7 +148,7 @@ export function ShoppingCart(props) {
|
|
|
146
148
|
}
|
|
147
149
|
else if (progressStep === "Checkout") {
|
|
148
150
|
// ========== CHECKOUT ==========
|
|
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:
|
|
151
|
+
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", {}), payPalClientID && (_jsx(PayPal, { payPalClientID: payPalClientID, checkoutData: getCheckoutData(), onApprove: handleOnApprove }))] }));
|
|
150
152
|
}
|
|
151
153
|
else if (progressStep === "ShippingInfo") {
|
|
152
154
|
// ========== SHOPPING CART ==========
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { generateGoogleFontsUrl } from './google-fonts';
|
|
3
3
|
import { ALL_WEBSAFE_FONTS } from './fonts';
|
|
4
|
+
import { assertVisualDesign } from '../../config/config.validators';
|
|
4
5
|
export function VisualDesignStyles({ visualdesign }) {
|
|
5
|
-
|
|
6
|
+
// Validate visualdesign early so invalid routes.json fails fast
|
|
7
|
+
assertVisualDesign(visualdesign);
|
|
8
|
+
const tokens = visualdesign;
|
|
6
9
|
const resolveValue = (v) => (v && typeof v === 'object' && 'value' in v) ? v.value : v;
|
|
7
10
|
// Check if Google Fonts are being used
|
|
8
11
|
const hasGoogleFonts = () => {
|
|
@@ -82,7 +85,7 @@ export function VisualDesignStyles({ visualdesign }) {
|
|
|
82
85
|
* Component to handle Google Fonts imports - should be used in the document head
|
|
83
86
|
*/
|
|
84
87
|
export function GoogleFontsImports({ visualdesign }) {
|
|
85
|
-
const tokens = visualdesign
|
|
88
|
+
const tokens = visualdesign;
|
|
86
89
|
const fonts = [];
|
|
87
90
|
// Extract Google font names from the new 3-field font structure
|
|
88
91
|
for (const [key, val] of Object.entries(tokens)) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Google Fonts Integration
|
|
3
3
|
* Fetches and caches Google Fonts data for use in visual design forms
|
|
4
4
|
*/
|
|
5
|
+
import { getFullPixelatedConfig } from '../../config/config';
|
|
5
6
|
// Cache for Google Fonts data
|
|
6
7
|
let fontsCache = null;
|
|
7
8
|
let cacheTimestamp = 0;
|
|
@@ -31,16 +32,17 @@ const FALLBACK_GOOGLE_FONTS = [
|
|
|
31
32
|
];
|
|
32
33
|
/**
|
|
33
34
|
* Fetch Google Fonts list from API
|
|
34
|
-
*
|
|
35
|
+
* Reads API key from `pixelated.config.json` under `google.api_key` (server-side)
|
|
35
36
|
*/
|
|
36
37
|
export async function fetchGoogleFonts() {
|
|
37
38
|
// Check cache first
|
|
38
39
|
if (fontsCache && (Date.now() - cacheTimestamp) < CACHE_DURATION) {
|
|
39
40
|
return fontsCache;
|
|
40
41
|
}
|
|
41
|
-
const
|
|
42
|
+
const cfg = getFullPixelatedConfig();
|
|
43
|
+
const apiKey = cfg?.google?.api_key;
|
|
42
44
|
if (!apiKey) {
|
|
43
|
-
console.warn('
|
|
45
|
+
console.warn('google.api_key not set in pixelated.config.json; returning empty fonts list');
|
|
44
46
|
return [];
|
|
45
47
|
}
|
|
46
48
|
try {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
|
|
3
|
+
import { getFullPixelatedConfig } from '../../../config/config';
|
|
4
|
+
const PAGES_DIR = getFullPixelatedConfig()?.global?.pagesDir || 'public/data/pages';
|
|
4
5
|
/**
|
|
5
6
|
* Get absolute path to pages directory
|
|
6
7
|
*/
|
|
@@ -1,70 +1,84 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
2
|
+
"global": {
|
|
3
|
+
"proxyUrl": "https://proxy.pixelated.tech/prod/proxy?url="
|
|
4
|
+
},
|
|
5
|
+
"cloudinary": {
|
|
6
|
+
"product_env": "dlbon7tpq",
|
|
7
|
+
"baseUrl": "https://res.cloudinary.com",
|
|
8
|
+
"secure": true,
|
|
9
|
+
"transforms": "f_auto,c_limit,q_auto,dpr_auto"
|
|
10
|
+
},
|
|
11
|
+
"contentful": {
|
|
12
|
+
"proxyURL": "https://proxy.pixelated.tech/prod/proxy?url=",
|
|
13
|
+
"base_url": "https://cdn.contentful.com",
|
|
14
|
+
"space_id": "ank9sh265hdu",
|
|
15
|
+
"environment": "master",
|
|
16
|
+
"delivery_access_token": "gcbxpeK2rfX4esUvaA9Hn_ngVuez03YfnGp5DHyVh5A",
|
|
17
|
+
"management_access_token": "CFPAT-CZmIOPsdKL7IU9UV6oVSTvM91MW9Se4g52gmBn-WlA4",
|
|
18
|
+
"preview_access_token": "W1Dw8BN_YzvqRoymEYDjBABQB3ulxTR421m2VfiLCyw"
|
|
19
|
+
},
|
|
20
|
+
"ebay": {
|
|
21
|
+
"proxyURL": "https://proxy.pixelated.tech/prod/proxy?url=",
|
|
22
|
+
"appId": "BrianWha-Pixelate-PRD-1fb4458de-1a8431fe",
|
|
23
|
+
"appDevId": "fa7b86b5-3a10-43ae-bf6f-497aa4e55ddd",
|
|
24
|
+
"appCertId": "PRD-fb4458deef01-0d54-496a-b572-a04b",
|
|
25
|
+
"sbxAppId": "BrianWha-Pixelate-SBX-ad482b6ae-8cb8fead",
|
|
26
|
+
"sbxAppDevId": "fa7b86b5-3a10-43ae-bf6f-497aa4e55ddd",
|
|
27
|
+
"sbxAppCertId": "SBX-d482b6ae0d62-f57c-4d3c-88b7-22ec",
|
|
28
|
+
"globalId": "EBAY_US",
|
|
29
|
+
"environment": "production",
|
|
30
|
+
"tokenScope": "https://api.ebay.com/oauth/api_scope",
|
|
31
|
+
"baseTokenURL": "https://api.ebay.com/identity/v1/oauth2/token",
|
|
32
|
+
"baseSearchURL": "https://api.ebay.com/buy/browse/v1/item_summary/search",
|
|
33
|
+
"baseAnalyticsURL": "https://api.ebay.com/developer/analytics/v1_beta",
|
|
34
|
+
"qsSearchURL": "?q=sunglasses&fieldgroups=full&category_ids=79720&aspect_filter=categoryId:79720&filter=sellers:{pixelatedtech}&sort=newlyListed&limit=200",
|
|
35
|
+
"baseItemURL": "https://api.ebay.com/buy/browse/v1/item",
|
|
36
|
+
"qsItemURL": "/v1|295959752403|0?fieldgroups=PRODUCT,ADDITIONAL_SELLER_DETAILS",
|
|
37
|
+
"itemCategory": "79720"
|
|
38
|
+
},
|
|
39
|
+
"flickr": {
|
|
40
|
+
"baseURL": "https://api.flickr.com/services/rest/?",
|
|
41
|
+
"urlProps": {
|
|
42
|
+
"method": "flickr.photos.search",
|
|
43
|
+
"api_key": "882cab5548d53c9e6b5fb24d59cc321d",
|
|
44
|
+
"user_id": "15473210@N04",
|
|
45
|
+
"tags": "pixelatedviewsgallery",
|
|
46
|
+
"extras": "date_taken,description,owner_name",
|
|
47
|
+
"sort": "date-taken-desc",
|
|
48
|
+
"per_page": 500,
|
|
49
|
+
"format": "json",
|
|
50
|
+
"photoSize": "Medium",
|
|
51
|
+
"nojsoncallback": "true"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"google": {
|
|
55
|
+
"client_id": "80165502504-j9d4l6qpfmvjkfetn261dsobivluj75c.apps.googleusercontent.com",
|
|
56
|
+
"client_secret": "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",
|
|
57
|
+
"api_key": "AIzaSyBJVi0O9Ir9imRgINLZbojTifatX-Z4aUs",
|
|
58
|
+
"refresh_token": "1//05NlarHOjB4fOCgYIARAAGAUSNgF-L9IrszHlwYnNU2fz5YtMHEyjVTYZ_SmOEQdw_qA64M1fJB7tHCQmMakQxpfFK-8A80sc0g"
|
|
59
|
+
},
|
|
60
|
+
"googleAnalytics": {
|
|
61
|
+
"id": "G-1J1W90VBE1",
|
|
62
|
+
"adId": "AW-17721931789"
|
|
63
|
+
},
|
|
64
|
+
"googleSearchConsole": {
|
|
65
|
+
"id": "009500278966481927899:bcssp73qony"
|
|
66
|
+
},
|
|
67
|
+
"googleMaps": {
|
|
68
|
+
"apiKey": "AIzaSyBJVi0O9Ir9imRgINLZbojTifatX-Z4aUs"
|
|
69
|
+
},
|
|
70
|
+
"nextAuth": {
|
|
71
|
+
"secret": "RZJ0yls+FdikOyfQ8UX0MB4bJFS9e73Wfaai1EVsUi8=",
|
|
72
|
+
"url": "https://localhost:3006"
|
|
73
|
+
},
|
|
74
|
+
"paypal": {
|
|
75
|
+
"sandboxPayPalApiKey": "AT10GG2ZHoApTtEw7dJoU6XRDYkf3wEvK2k_-eZ9GOvOK-REphG8yKCyZCqFi95OrxKgrdctlfWxayHG",
|
|
76
|
+
"sandboxPayPalSecret": "EDUrdPonwcNYZwO5j7hNmFSmF-13zptaCndUnO0-Vr_j0GYEW4m-Tfar9IaukHwm0ixL5fUojOOFtZVk",
|
|
77
|
+
"payPalApiKey": "AeWRwYpsrfslATCndF6xjL4GLcqA1UxQZLC5vxQE-FTvPezXfLbCJO_uAFk5zoXUKRFnP-zJ_73yEkBE",
|
|
78
|
+
"payPalSecret": "EBvYvynRXZCI6RbK4rg2NiENNG4N8tbgl8qAmpxB6f9nUkZjXMODxXJZ91JycP439kPrQcnB7uRKp0-F"
|
|
79
|
+
},
|
|
80
|
+
"wordpress": {
|
|
81
|
+
"baseURL": "https://public-api.wordpress.com/rest/v1/sites/",
|
|
82
|
+
"site": "blog.pixelated.tech"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -6,6 +6,7 @@ export * from './components/admin/site-health/site-health-axe-core';
|
|
|
6
6
|
export * from './components/admin/site-health/site-health-cloudwatch';
|
|
7
7
|
export * from './components/admin/site-health/site-health-cloudwatch.integration';
|
|
8
8
|
export * from './components/admin/site-health/site-health-core-web-vitals.integration';
|
|
9
|
+
export * from './components/admin/site-health/site-health-axe-core.integration';
|
|
9
10
|
export * from './components/admin/site-health/site-health-dependency-vulnerabilities';
|
|
10
11
|
export * from './components/admin/site-health/site-health-github';
|
|
11
12
|
export * from './components/admin/site-health/site-health-google-analytics';
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
export * from './components/config/config.client';
|
|
3
3
|
export * from './components/config/config.types';
|
|
4
4
|
export * from './components/config/config.utils';
|
|
5
|
+
export * from './components/config/config.validators';
|
|
5
6
|
export * from './components/general/404';
|
|
6
7
|
export * from './components/general/accordion';
|
|
7
8
|
export * from './components/general/buzzwordbingo';
|
|
9
|
+
export * from './components/general/cache-manager';
|
|
8
10
|
export * from './components/general/calendly';
|
|
9
11
|
export * from './components/general/callout';
|
|
10
12
|
export * from './components/general/carousel';
|
|
@@ -38,6 +40,7 @@ export * from './components/general/menu-simple';
|
|
|
38
40
|
export * from './components/general/metadata.components';
|
|
39
41
|
export * from './components/general/metadata.functions';
|
|
40
42
|
export * from './components/general/microinteractions';
|
|
43
|
+
export * from './components/general/proxy-csp-listener';
|
|
41
44
|
export * from './components/general/modal';
|
|
42
45
|
export * from './components/general/nerdjoke';
|
|
43
46
|
export * from './components/general/recipe';
|
package/dist/index.server.js
CHANGED
|
@@ -9,6 +9,7 @@ export * from './components/config/config';
|
|
|
9
9
|
export * from './components/config/config.server';
|
|
10
10
|
export * from './components/config/config.types';
|
|
11
11
|
export * from './components/config/config.utils';
|
|
12
|
+
export * from './components/config/config.validators';
|
|
12
13
|
export * from './components/config/crypto';
|
|
13
14
|
// SEO
|
|
14
15
|
export * from './components/general/contentful.delivery';
|
package/dist/scripts/release.sh
CHANGED
|
@@ -143,7 +143,7 @@ fi
|
|
|
143
143
|
echo ""
|
|
144
144
|
echo "đž Step 5: Committing changes..."
|
|
145
145
|
echo "================================================="
|
|
146
|
-
if grep -q "\"config:encrypt\":" package.json
|
|
146
|
+
if grep -q "\"config:encrypt\":" package.json; then
|
|
147
147
|
echo "đ Encrypting configuration..."
|
|
148
148
|
npm run config:encrypt
|
|
149
149
|
fi
|
|
@@ -200,7 +200,7 @@ else
|
|
|
200
200
|
echo "âšī¸ Tag v$new_version already exists"
|
|
201
201
|
fi
|
|
202
202
|
|
|
203
|
-
if grep -q "\"config:decrypt\":" package.json
|
|
203
|
+
if grep -q "\"config:decrypt\":" package.json; then
|
|
204
204
|
echo "đ Decrypting configuration for local development..."
|
|
205
205
|
npm run config:decrypt
|
|
206
206
|
fi
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import configJson from '@/config/pixelated.config.json';
|
|
2
|
+
/**
|
|
3
|
+
* Standard mock configuration derived from the main pixelated.config.json.
|
|
4
|
+
* Used as the default configuration for renderWithProviders in tests.
|
|
5
|
+
*/
|
|
6
|
+
export const mockConfig = configJson;
|
|
7
|
+
/**
|
|
8
|
+
* Helper to create a partial configuration override for specific test cases.
|
|
9
|
+
*/
|
|
10
|
+
export const createMockConfig = (overrides) => ({
|
|
11
|
+
...mockConfig,
|
|
12
|
+
...overrides,
|
|
13
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { afterEach, vi, beforeAll, afterAll } from 'vitest';
|
|
2
|
+
import { cleanup } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
// Cleanup after each test
|
|
5
|
+
afterEach(() => {
|
|
6
|
+
cleanup();
|
|
7
|
+
});
|
|
8
|
+
// Mock window.matchMedia
|
|
9
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
10
|
+
writable: true,
|
|
11
|
+
value: vi.fn().mockImplementation(query => ({
|
|
12
|
+
matches: false,
|
|
13
|
+
media: query,
|
|
14
|
+
onchange: null,
|
|
15
|
+
addListener: vi.fn(),
|
|
16
|
+
removeListener: vi.fn(),
|
|
17
|
+
addEventListener: vi.fn(),
|
|
18
|
+
removeEventListener: vi.fn(),
|
|
19
|
+
dispatchEvent: vi.fn(),
|
|
20
|
+
})),
|
|
21
|
+
});
|
|
22
|
+
// Mock IntersectionObserver
|
|
23
|
+
global.IntersectionObserver = class IntersectionObserver {
|
|
24
|
+
constructor() { }
|
|
25
|
+
disconnect() { }
|
|
26
|
+
observe() { }
|
|
27
|
+
takeRecords() {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
unobserve() { }
|
|
31
|
+
};
|
|
32
|
+
// Suppress console errors in tests (optional)
|
|
33
|
+
const originalError = console.error;
|
|
34
|
+
beforeAll(() => {
|
|
35
|
+
console.error = (...args) => {
|
|
36
|
+
if (typeof args[0] === 'string' &&
|
|
37
|
+
(args[0].includes('Warning: ReactDOM.render') ||
|
|
38
|
+
args[0].includes('Not implemented: HTMLFormElement.prototype.submit'))) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
originalError.call(console, ...args);
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
afterAll(() => {
|
|
45
|
+
console.error = originalError;
|
|
46
|
+
});
|