@szymonpiatek/nextwordpress 0.0.12 → 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 +45 -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 +45 -7
- package/dist/client/index.js.map +1 -1
- package/dist/hooks/index.cjs +45 -6
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +9 -2
- package/dist/hooks/index.d.ts +9 -2
- package/dist/hooks/index.js +45 -7
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +55 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +54 -1
- package/dist/index.js.map +1 -1
- package/dist/server/index.cjs +55 -0
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +54 -1
- package/dist/server/index.js.map +1 -1
- package/dist/{types-WcyioRuq.d.cts → types-BELSHjQr.d.cts} +13 -1
- package/dist/{types-WcyioRuq.d.ts → types-BELSHjQr.d.ts} +13 -1
- package/package.json +1 -1
package/dist/server/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { x as AuthenticationError, A as Author, B as BlockType, E as EditorBlock,
|
|
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
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 { x as AuthenticationError, A as Author, B as BlockType, E as EditorBlock,
|
|
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
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
|
@@ -4207,6 +4207,59 @@ async function resolvePreviewSlug(config, postId, previewPathname) {
|
|
|
4207
4207
|
return data.slug ?? `preview-${postId}`;
|
|
4208
4208
|
}
|
|
4209
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
|
+
|
|
4210
4263
|
// src/auth/applicationPassword.ts
|
|
4211
4264
|
function createApplicationPasswordToken(username, appPassword) {
|
|
4212
4265
|
const encoded = Buffer.from(`${username}:${appPassword}`).toString("base64");
|
|
@@ -4258,6 +4311,6 @@ async function validateJwtToken(config, token) {
|
|
|
4258
4311
|
return response.ok;
|
|
4259
4312
|
}
|
|
4260
4313
|
|
|
4261
|
-
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, createWPULikeClient, createWPULikeQueries, 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 };
|
|
4262
4315
|
//# sourceMappingURL=index.js.map
|
|
4263
4316
|
//# sourceMappingURL=index.js.map
|