@szymonpiatek/nextwordpress 0.0.11 → 0.0.13
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/dist/client/index.cjs +118 -6
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +115 -7
- package/dist/client/index.js.map +1 -1
- package/dist/hooks/index.cjs +118 -6
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +18 -2
- package/dist/hooks/index.d.ts +18 -2
- package/dist/hooks/index.js +115 -7
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +89 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +86 -1
- package/dist/index.js.map +1 -1
- package/dist/server/index.cjs +89 -0
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +86 -1
- package/dist/server/index.js.map +1 -1
- package/dist/{types-Dxb6tuW_.d.cts → types-BELSHjQr.d.cts} +45 -1
- package/dist/{types-Dxb6tuW_.d.ts → types-BELSHjQr.d.ts} +45 -1
- package/package.json +1 -1
package/dist/server/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { CF7SubmissionResponse, CF7SubmissionStatus, CF7ValidationError, Category, Comment, CommentAuthorAvatar, CreateAttributeTermInput, CreateAuthorInput, CreateCategoryInput, CreateCommentInput, CreateCouponInput, CreateMenuInput, CreateMenuItemInput, CreatePageInput, CreatePostInput, CreateProductAttributeInput, CreateProductCategoryInput, CreateProductInput, CreateProductReviewInput, CreateProductTagInput, CreateShippingClassInput, CreateShippingZoneInput, CreateShippingZoneMethodInput, CreateTagInput, CreateTaxClassInput, CreateTaxRateInput, CreateWebhookInput, FaustConfig, FaustPreviewConfig, FaustPreviewDeps, GQLACFFieldGroup, GQLAuthor, GQLCPTNode, GQLCategory, GQLCreateCommentInput, GQLCreateCommentResult, GQLCreatePostInput, GQLCustomer, GQLDeletePostResult, GQLLineItem, GQLMutatedComment, GQLMutatedPost, GQLOrder, GQLOrderAddress, GQLPage, GQLPageWithSEO, GQLPostStatus, GQLPostWithSEO, GQLProduct, GQLProductFilter, GQLProductVariation, GQLTag, GQLUpdatePostInput, GQLYoastSEO, Menu, MenuItem, MenuLocation, MenuWithItems, OmnibusPriceEntry, OmnibusProductData, Page, RestPageStatus, RestPostStatus, RevalidationConfig, RevalidationPayload, RevalidationResult, Tag, UpdateAttributeTermInput, UpdateAuthorInput, UpdateCategoryInput, UpdateCommentInput, UpdateCouponInput, UpdateMediaInput, UpdateMenuInput, UpdateMenuItemInput, UpdatePageInput, UpdatePostInput, UpdateProductAttributeInput, UpdateProductCategoryInput, UpdateProductInput, UpdateProductReviewInput, UpdateProductTagInput, UpdateShippingClassInput, UpdateShippingZoneInput, UpdateShippingZoneMethodInput, UpdateTagInput, UpdateTaxRateInput, UpdateWebhookInput, UploadMediaInput, WCAttributeTerm, WCContinent, WCCountry, WCCoupon, WCCreateOrderNoteInput, WCCreateOrderRefundInput, WCCurrency, WCGlobalProductAttribute, WCOrderNote, WCOrderRefund, WCPaymentGateway, WCPaymentGatewaySetting, WCProductCategory, WCProductReview, WCProductReviewFilterParams, WCProductStatus, WCProductTag, WCProductVariationWithOmnibus, WCProductWithOmnibus, WCRefundLineItem, WCReviewStatus, WCSalesReport, WCSalesReportParams, WCSettingGroup, WCSettingOption, WCShippingClass, WCShippingMethod, WCShippingZone, WCShippingZoneLocation, WCShippingZoneMethod, WCStatusCount, WCSystemStatus, WCSystemStatusTool, WCTaxClass, WCTaxRate, WCTopSeller, WCTopSellersParams, WCWebhook, WCWebhookStatus, WCWebhookTopic, WPGraphQLFetcher, WooCommerceFetcher, authenticateJwt, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createApplicationPasswordToken, createAuthorsMutations, createCF7Queries, createCPTQueries, createCategoriesMutations, createCommentsMutations, createFaustAuthHandler, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createPreviewHandler, createRevalidationHandler, createTagsMutations, createWPGraphQLClient, createWPGraphQLClient as createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYoastQueries, extractOmnibusData, resolveBaseUrl, validateJwtToken, withOmnibus, withOmnibusVariation } from '../index.cjs';
|
|
1
|
+
export { x as AuthenticationError, A as Author, B as BlockType, C as CookieConsentCategories, y as CookieConsentConfig, E as EditorBlock, z as EmbeddedAuthor, D as EmbeddedTerm, H as ErrorCode, F as FeaturedMedia, j as GQLConnection, I as GQLError, K as GQLPageInfo, G as GQLPost, i as GQLPostFilter, J as JwtAuthCredentials, q as JwtAuthResponse, M as MediaDetails, L as MediaSize, N as NextWordpressConfig, P as Post, O as PostEmbedded, s as RenderedContent, R as RenderedTitle, S as SearchResult, T as Taxonomy, Q as TemplatePart, U as UpdateCustomerInput, v as WCAddress, e as WCCreateOrderInput, g as WCCustomer, V as WCDimensions, t as WCImage, f as WCOrder, X as WCOrderLineItem, b as WCProduct, Y as WCProductAttribute, Z as WCProductDefaultAttribute, c as WCProductFilterParams, u as WCProductVariation, _ as WCShippingLine, r as WPEntity, h as WPGraphQLConfig, $ as WPGraphQLError, o as WPULikeCheckParams, p as WPULikeCheckResponse, a0 as WPULikeItemType, l as WPULikeStats, k as WPULikeStatsParams, m as WPULikeStatus, w as WPULikeVoteParams, n as WPULikeVoteResponse, a as WooCommerceConfig, a1 as WooCommerceError, a2 as WooCommercePaginationHeaders, d as WooCommerceResponse, a3 as WordPressAPIError, a4 as createCookieConsentHandler, a5 as defaultMessages, a6 as defaultMessagesPl, a7 as parseCookieConsent, a8 as resolveMessage } from '../types-BELSHjQr.cjs';
|
|
2
|
+
export { CF7SubmissionResponse, CF7SubmissionStatus, CF7ValidationError, Category, Comment, CommentAuthorAvatar, CreateAttributeTermInput, CreateAuthorInput, CreateCategoryInput, CreateCommentInput, CreateCouponInput, CreateMenuInput, CreateMenuItemInput, CreatePageInput, CreatePostInput, CreateProductAttributeInput, CreateProductCategoryInput, CreateProductInput, CreateProductReviewInput, CreateProductTagInput, CreateShippingClassInput, CreateShippingZoneInput, CreateShippingZoneMethodInput, CreateTagInput, CreateTaxClassInput, CreateTaxRateInput, CreateWebhookInput, FaustConfig, FaustPreviewConfig, FaustPreviewDeps, GQLACFFieldGroup, GQLAuthor, GQLCPTNode, GQLCategory, GQLCreateCommentInput, GQLCreateCommentResult, GQLCreatePostInput, GQLCustomer, GQLDeletePostResult, GQLLineItem, GQLMutatedComment, GQLMutatedPost, GQLOrder, GQLOrderAddress, GQLPage, GQLPageWithSEO, GQLPostStatus, GQLPostWithSEO, GQLProduct, GQLProductFilter, GQLProductVariation, GQLTag, GQLUpdatePostInput, GQLYoastSEO, Menu, MenuItem, MenuLocation, MenuWithItems, OmnibusPriceEntry, OmnibusProductData, Page, RestPageStatus, RestPostStatus, RevalidationConfig, RevalidationPayload, RevalidationResult, Tag, UpdateAttributeTermInput, UpdateAuthorInput, UpdateCategoryInput, UpdateCommentInput, UpdateCouponInput, UpdateMediaInput, UpdateMenuInput, UpdateMenuItemInput, UpdatePageInput, UpdatePostInput, UpdateProductAttributeInput, UpdateProductCategoryInput, UpdateProductInput, UpdateProductReviewInput, UpdateProductTagInput, UpdateShippingClassInput, UpdateShippingZoneInput, UpdateShippingZoneMethodInput, UpdateTagInput, UpdateTaxRateInput, UpdateWebhookInput, UploadMediaInput, WCAttributeTerm, WCContinent, WCCountry, WCCoupon, WCCreateOrderNoteInput, WCCreateOrderRefundInput, WCCurrency, WCGlobalProductAttribute, WCOrderNote, WCOrderRefund, WCPaymentGateway, WCPaymentGatewaySetting, WCProductCategory, WCProductReview, WCProductReviewFilterParams, WCProductStatus, WCProductTag, WCProductVariationWithOmnibus, WCProductWithOmnibus, WCRefundLineItem, WCReviewStatus, WCSalesReport, WCSalesReportParams, WCSettingGroup, WCSettingOption, WCShippingClass, WCShippingMethod, WCShippingZone, WCShippingZoneLocation, WCShippingZoneMethod, WCStatusCount, WCSystemStatus, WCSystemStatusTool, WCTaxClass, WCTaxRate, WCTopSeller, WCTopSellersParams, WCWebhook, WCWebhookStatus, WCWebhookTopic, WPGraphQLFetcher, WooCommerceFetcher, authenticateJwt, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createApplicationPasswordToken, createAuthorsMutations, createCF7Queries, createCPTQueries, createCategoriesMutations, createCommentsMutations, createFaustAuthHandler, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createPreviewHandler, createRevalidationHandler, createTagsMutations, createWPGraphQLClient, createWPGraphQLClient as createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWPULikeClient, createWPULikeQueries, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYoastQueries, extractOmnibusData, resolveBaseUrl, validateJwtToken, withOmnibus, withOmnibusVariation } from '../index.cjs';
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { CF7SubmissionResponse, CF7SubmissionStatus, CF7ValidationError, Category, Comment, CommentAuthorAvatar, CreateAttributeTermInput, CreateAuthorInput, CreateCategoryInput, CreateCommentInput, CreateCouponInput, CreateMenuInput, CreateMenuItemInput, CreatePageInput, CreatePostInput, CreateProductAttributeInput, CreateProductCategoryInput, CreateProductInput, CreateProductReviewInput, CreateProductTagInput, CreateShippingClassInput, CreateShippingZoneInput, CreateShippingZoneMethodInput, CreateTagInput, CreateTaxClassInput, CreateTaxRateInput, CreateWebhookInput, FaustConfig, FaustPreviewConfig, FaustPreviewDeps, GQLACFFieldGroup, GQLAuthor, GQLCPTNode, GQLCategory, GQLCreateCommentInput, GQLCreateCommentResult, GQLCreatePostInput, GQLCustomer, GQLDeletePostResult, GQLLineItem, GQLMutatedComment, GQLMutatedPost, GQLOrder, GQLOrderAddress, GQLPage, GQLPageWithSEO, GQLPostStatus, GQLPostWithSEO, GQLProduct, GQLProductFilter, GQLProductVariation, GQLTag, GQLUpdatePostInput, GQLYoastSEO, Menu, MenuItem, MenuLocation, MenuWithItems, OmnibusPriceEntry, OmnibusProductData, Page, RestPageStatus, RestPostStatus, RevalidationConfig, RevalidationPayload, RevalidationResult, Tag, UpdateAttributeTermInput, UpdateAuthorInput, UpdateCategoryInput, UpdateCommentInput, UpdateCouponInput, UpdateMediaInput, UpdateMenuInput, UpdateMenuItemInput, UpdatePageInput, UpdatePostInput, UpdateProductAttributeInput, UpdateProductCategoryInput, UpdateProductInput, UpdateProductReviewInput, UpdateProductTagInput, UpdateShippingClassInput, UpdateShippingZoneInput, UpdateShippingZoneMethodInput, UpdateTagInput, UpdateTaxRateInput, UpdateWebhookInput, UploadMediaInput, WCAttributeTerm, WCContinent, WCCountry, WCCoupon, WCCreateOrderNoteInput, WCCreateOrderRefundInput, WCCurrency, WCGlobalProductAttribute, WCOrderNote, WCOrderRefund, WCPaymentGateway, WCPaymentGatewaySetting, WCProductCategory, WCProductReview, WCProductReviewFilterParams, WCProductStatus, WCProductTag, WCProductVariationWithOmnibus, WCProductWithOmnibus, WCRefundLineItem, WCReviewStatus, WCSalesReport, WCSalesReportParams, WCSettingGroup, WCSettingOption, WCShippingClass, WCShippingMethod, WCShippingZone, WCShippingZoneLocation, WCShippingZoneMethod, WCStatusCount, WCSystemStatus, WCSystemStatusTool, WCTaxClass, WCTaxRate, WCTopSeller, WCTopSellersParams, WCWebhook, WCWebhookStatus, WCWebhookTopic, WPGraphQLFetcher, WooCommerceFetcher, authenticateJwt, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createApplicationPasswordToken, createAuthorsMutations, createCF7Queries, createCPTQueries, createCategoriesMutations, createCommentsMutations, createFaustAuthHandler, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createPreviewHandler, createRevalidationHandler, createTagsMutations, createWPGraphQLClient, createWPGraphQLClient as createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYoastQueries, extractOmnibusData, resolveBaseUrl, validateJwtToken, withOmnibus, withOmnibusVariation } from '../index.js';
|
|
1
|
+
export { x as AuthenticationError, A as Author, B as BlockType, C as CookieConsentCategories, y as CookieConsentConfig, E as EditorBlock, z as EmbeddedAuthor, D as EmbeddedTerm, H as ErrorCode, F as FeaturedMedia, j as GQLConnection, I as GQLError, K as GQLPageInfo, G as GQLPost, i as GQLPostFilter, J as JwtAuthCredentials, q as JwtAuthResponse, M as MediaDetails, L as MediaSize, N as NextWordpressConfig, P as Post, O as PostEmbedded, s as RenderedContent, R as RenderedTitle, S as SearchResult, T as Taxonomy, Q as TemplatePart, U as UpdateCustomerInput, v as WCAddress, e as WCCreateOrderInput, g as WCCustomer, V as WCDimensions, t as WCImage, f as WCOrder, X as WCOrderLineItem, b as WCProduct, Y as WCProductAttribute, Z as WCProductDefaultAttribute, c as WCProductFilterParams, u as WCProductVariation, _ as WCShippingLine, r as WPEntity, h as WPGraphQLConfig, $ as WPGraphQLError, o as WPULikeCheckParams, p as WPULikeCheckResponse, a0 as WPULikeItemType, l as WPULikeStats, k as WPULikeStatsParams, m as WPULikeStatus, w as WPULikeVoteParams, n as WPULikeVoteResponse, a as WooCommerceConfig, a1 as WooCommerceError, a2 as WooCommercePaginationHeaders, d as WooCommerceResponse, a3 as WordPressAPIError, a4 as createCookieConsentHandler, a5 as defaultMessages, a6 as defaultMessagesPl, a7 as parseCookieConsent, a8 as resolveMessage } from '../types-BELSHjQr.js';
|
|
2
|
+
export { CF7SubmissionResponse, CF7SubmissionStatus, CF7ValidationError, Category, Comment, CommentAuthorAvatar, CreateAttributeTermInput, CreateAuthorInput, CreateCategoryInput, CreateCommentInput, CreateCouponInput, CreateMenuInput, CreateMenuItemInput, CreatePageInput, CreatePostInput, CreateProductAttributeInput, CreateProductCategoryInput, CreateProductInput, CreateProductReviewInput, CreateProductTagInput, CreateShippingClassInput, CreateShippingZoneInput, CreateShippingZoneMethodInput, CreateTagInput, CreateTaxClassInput, CreateTaxRateInput, CreateWebhookInput, FaustConfig, FaustPreviewConfig, FaustPreviewDeps, GQLACFFieldGroup, GQLAuthor, GQLCPTNode, GQLCategory, GQLCreateCommentInput, GQLCreateCommentResult, GQLCreatePostInput, GQLCustomer, GQLDeletePostResult, GQLLineItem, GQLMutatedComment, GQLMutatedPost, GQLOrder, GQLOrderAddress, GQLPage, GQLPageWithSEO, GQLPostStatus, GQLPostWithSEO, GQLProduct, GQLProductFilter, GQLProductVariation, GQLTag, GQLUpdatePostInput, GQLYoastSEO, Menu, MenuItem, MenuLocation, MenuWithItems, OmnibusPriceEntry, OmnibusProductData, Page, RestPageStatus, RestPostStatus, RevalidationConfig, RevalidationPayload, RevalidationResult, Tag, UpdateAttributeTermInput, UpdateAuthorInput, UpdateCategoryInput, UpdateCommentInput, UpdateCouponInput, UpdateMediaInput, UpdateMenuInput, UpdateMenuItemInput, UpdatePageInput, UpdatePostInput, UpdateProductAttributeInput, UpdateProductCategoryInput, UpdateProductInput, UpdateProductReviewInput, UpdateProductTagInput, UpdateShippingClassInput, UpdateShippingZoneInput, UpdateShippingZoneMethodInput, UpdateTagInput, UpdateTaxRateInput, UpdateWebhookInput, UploadMediaInput, WCAttributeTerm, WCContinent, WCCountry, WCCoupon, WCCreateOrderNoteInput, WCCreateOrderRefundInput, WCCurrency, WCGlobalProductAttribute, WCOrderNote, WCOrderRefund, WCPaymentGateway, WCPaymentGatewaySetting, WCProductCategory, WCProductReview, WCProductReviewFilterParams, WCProductStatus, WCProductTag, WCProductVariationWithOmnibus, WCProductWithOmnibus, WCRefundLineItem, WCReviewStatus, WCSalesReport, WCSalesReportParams, WCSettingGroup, WCSettingOption, WCShippingClass, WCShippingMethod, WCShippingZone, WCShippingZoneLocation, WCShippingZoneMethod, WCStatusCount, WCSystemStatus, WCSystemStatusTool, WCTaxClass, WCTaxRate, WCTopSeller, WCTopSellersParams, WCWebhook, WCWebhookStatus, WCWebhookTopic, WPGraphQLFetcher, WooCommerceFetcher, authenticateJwt, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createApplicationPasswordToken, createAuthorsMutations, createCF7Queries, createCPTQueries, createCategoriesMutations, createCommentsMutations, createFaustAuthHandler, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createPreviewHandler, createRevalidationHandler, createTagsMutations, createWPGraphQLClient, createWPGraphQLClient as createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWPULikeClient, createWPULikeQueries, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYoastQueries, extractOmnibusData, resolveBaseUrl, validateJwtToken, withOmnibus, withOmnibusVariation } from '../index.js';
|
package/dist/server/index.js
CHANGED
|
@@ -2099,6 +2099,38 @@ function createWooCommerceClient(config) {
|
|
|
2099
2099
|
};
|
|
2100
2100
|
}
|
|
2101
2101
|
|
|
2102
|
+
// src/integrations/restApi/wpulike/queries.ts
|
|
2103
|
+
function createWPULikeQueries(fetcher) {
|
|
2104
|
+
const { wpFetch, wpMutate } = fetcher;
|
|
2105
|
+
async function getLikeStats(params, tags) {
|
|
2106
|
+
return wpFetch(
|
|
2107
|
+
"/wp-json/wp-ulike/v1/stats",
|
|
2108
|
+
params,
|
|
2109
|
+
tags ?? ["wpulike", `wpulike-${params.id}`]
|
|
2110
|
+
);
|
|
2111
|
+
}
|
|
2112
|
+
async function checkLikeStatus(params, tags) {
|
|
2113
|
+
return wpFetch(
|
|
2114
|
+
"/wp-json/wp-ulike/v1/check",
|
|
2115
|
+
params,
|
|
2116
|
+
tags ?? ["wpulike", `wpulike-${params.id}`]
|
|
2117
|
+
);
|
|
2118
|
+
}
|
|
2119
|
+
async function vote(params, authToken) {
|
|
2120
|
+
return wpMutate(
|
|
2121
|
+
"/wp-json/wp-ulike/v1/vote",
|
|
2122
|
+
params,
|
|
2123
|
+
"POST",
|
|
2124
|
+
authToken
|
|
2125
|
+
);
|
|
2126
|
+
}
|
|
2127
|
+
return { getLikeStats, checkLikeStatus, vote };
|
|
2128
|
+
}
|
|
2129
|
+
function createWPULikeClient(config) {
|
|
2130
|
+
const fetcher = createFetcher(config);
|
|
2131
|
+
return createWPULikeQueries(fetcher);
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2102
2134
|
// src/integrations/wpGraphQL/client/types.ts
|
|
2103
2135
|
var WPGraphQLError = class extends Error {
|
|
2104
2136
|
constructor(code, status, endpoint, message, gqlErrors) {
|
|
@@ -4175,6 +4207,59 @@ async function resolvePreviewSlug(config, postId, previewPathname) {
|
|
|
4175
4207
|
return data.slug ?? `preview-${postId}`;
|
|
4176
4208
|
}
|
|
4177
4209
|
|
|
4210
|
+
// src/nextjs/cookieConsent.ts
|
|
4211
|
+
function createCookieConsentHandler(config) {
|
|
4212
|
+
const cookieName = config?.cookieName ?? "cookie_notice_accepted";
|
|
4213
|
+
const maxAge = config?.maxAge ?? 31536e3;
|
|
4214
|
+
return async function handler(request) {
|
|
4215
|
+
if (request.method === "GET") {
|
|
4216
|
+
const consent = parseCookieConsent(request, cookieName);
|
|
4217
|
+
return Response.json(consent ?? null);
|
|
4218
|
+
}
|
|
4219
|
+
if (request.method === "POST") {
|
|
4220
|
+
const body = await request.json();
|
|
4221
|
+
const categories = {
|
|
4222
|
+
necessary: true,
|
|
4223
|
+
analytics: body.analytics ?? false,
|
|
4224
|
+
marketing: body.marketing ?? false
|
|
4225
|
+
};
|
|
4226
|
+
return new Response(JSON.stringify(categories), {
|
|
4227
|
+
status: 200,
|
|
4228
|
+
headers: {
|
|
4229
|
+
"Content-Type": "application/json",
|
|
4230
|
+
"Set-Cookie": buildConsentCookie(cookieName, encodeURIComponent(JSON.stringify(categories)), maxAge)
|
|
4231
|
+
}
|
|
4232
|
+
});
|
|
4233
|
+
}
|
|
4234
|
+
if (request.method === "DELETE") {
|
|
4235
|
+
return new Response(null, {
|
|
4236
|
+
status: 204,
|
|
4237
|
+
headers: {
|
|
4238
|
+
"Set-Cookie": `${cookieName}=; Max-Age=0; Path=/; SameSite=Lax`
|
|
4239
|
+
}
|
|
4240
|
+
});
|
|
4241
|
+
}
|
|
4242
|
+
return Response.json({ error: "Method Not Allowed" }, { status: 405 });
|
|
4243
|
+
};
|
|
4244
|
+
}
|
|
4245
|
+
function parseCookieConsent(request, cookieName = "cookie_notice_accepted") {
|
|
4246
|
+
const header = request.headers.get("cookie") ?? "";
|
|
4247
|
+
const match = header.match(new RegExp(`(?:^|;\\s*)${cookieName}=([^;]*)`));
|
|
4248
|
+
if (!match) return null;
|
|
4249
|
+
if (match[1] === "1") return { necessary: true, analytics: true, marketing: true };
|
|
4250
|
+
try {
|
|
4251
|
+
const parsed = JSON.parse(decodeURIComponent(match[1]));
|
|
4252
|
+
if (typeof parsed !== "object" || parsed === null) return null;
|
|
4253
|
+
return { necessary: true, analytics: parsed.analytics ?? false, marketing: parsed.marketing ?? false };
|
|
4254
|
+
} catch {
|
|
4255
|
+
return null;
|
|
4256
|
+
}
|
|
4257
|
+
}
|
|
4258
|
+
function buildConsentCookie(name, value, maxAge) {
|
|
4259
|
+
const secure = process.env.NODE_ENV === "production" ? "; Secure" : "";
|
|
4260
|
+
return `${name}=${value}; Path=/; SameSite=Lax; Max-Age=${maxAge}${secure}`;
|
|
4261
|
+
}
|
|
4262
|
+
|
|
4178
4263
|
// src/auth/applicationPassword.ts
|
|
4179
4264
|
function createApplicationPasswordToken(username, appPassword) {
|
|
4180
4265
|
const encoded = Buffer.from(`${username}:${appPassword}`).toString("base64");
|
|
@@ -4226,6 +4311,6 @@ async function validateJwtToken(config, token) {
|
|
|
4226
4311
|
return response.ok;
|
|
4227
4312
|
}
|
|
4228
4313
|
|
|
4229
|
-
export { AuthenticationError, ErrorCode, WPGraphQLError, WooCommerceError, WordPressAPIError, authenticateJwt, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createApplicationPasswordToken, createAuthorsMutations, createCF7Queries, createCPTQueries, createCategoriesMutations, createCommentsMutations, createFaustAuthHandler, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createPreviewHandler, createRevalidationHandler, createTagsMutations, createWPGraphQLCoreClient as createWPGraphQLClient, createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYoastQueries, defaultMessages, defaultMessagesPl, extractOmnibusData, resolveBaseUrl, resolveMessage, validateJwtToken, withOmnibus, withOmnibusVariation };
|
|
4314
|
+
export { AuthenticationError, ErrorCode, WPGraphQLError, WooCommerceError, WordPressAPIError, authenticateJwt, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createApplicationPasswordToken, createAuthorsMutations, createCF7Queries, createCPTQueries, createCategoriesMutations, createCommentsMutations, createCookieConsentHandler, createFaustAuthHandler, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createPreviewHandler, createRevalidationHandler, createTagsMutations, createWPGraphQLCoreClient as createWPGraphQLClient, createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWPULikeClient, createWPULikeQueries, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYoastQueries, defaultMessages, defaultMessagesPl, extractOmnibusData, parseCookieConsent, resolveBaseUrl, resolveMessage, validateJwtToken, withOmnibus, withOmnibusVariation };
|
|
4230
4315
|
//# sourceMappingURL=index.js.map
|
|
4231
4316
|
//# sourceMappingURL=index.js.map
|