@szymonpiatek/nextwordpress 0.0.14 → 0.0.15

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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { N as NextWordpressConfig, J as JwtAuthCredentials, r as JwtAuthResponse, a as WooCommerceConfig, d as WooCommerceResponse, W as WordPressResponse, T as Taxonomy, s as WPEntity, R as RenderedTitle, t as RenderedContent, P as Post, A as Author, F as FeaturedMedia, u as WCImage, v as WCProductVariation, b as WCProduct, g as WCCustomer, w as WCAddress, U as UpdateCustomerInput, e as WCCreateOrderInput, f as WCOrder, c as WCProductFilterParams, k as WPULikeStatsParams, l as WPULikeStats, o as WPULikeCheckParams, p as WPULikeCheckResponse, x as WPULikeVoteParams, n as WPULikeVoteResponse, q as CF7SubmissionResponse, h as WPGraphQLConfig, j as GQLConnection, i as GQLPostFilter, G as GQLPost } from './types-COJWPg77.cjs';
2
- export { y as AuthenticationError, B as BlockType, z as CF7SubmissionStatus, D as CF7ValidationError, C as CookieConsentCategories, E as CookieConsentConfig, H as EditorBlock, I as EmbeddedAuthor, K as EmbeddedTerm, L as ErrorCode, M as GQLError, O as GQLPageInfo, Q as MediaDetails, S as MediaSize, V as PostEmbedded, X as SearchResult, Y as TemplatePart, Z as WCDimensions, _ as WCOrderLineItem, $ as WCProductAttribute, a0 as WCProductDefaultAttribute, a1 as WCShippingLine, a2 as WPGraphQLError, a3 as WPULikeItemType, m as WPULikeStatus, a4 as WooCommerceError, a5 as WooCommercePaginationHeaders, a6 as WordPressAPIError, a7 as createCookieConsentHandler, a8 as defaultMessages, a9 as defaultMessagesPl, aa as parseCookieConsent, ab as resolveMessage } from './types-COJWPg77.cjs';
1
+ import { N as NextWordpressConfig, J as JwtAuthCredentials, r as JwtAuthResponse, a as WooCommerceConfig, d as WooCommerceResponse, W as WordPressResponse, T as Taxonomy, s as WPEntity, R as RenderedTitle, t as RenderedContent, P as Post, A as Author, F as FeaturedMedia, u as WCImage, v as WCProductVariation, b as WCProduct, g as WCCustomer, w as WCAddress, U as UpdateCustomerInput, e as WCCreateOrderInput, f as WCOrder, c as WCProductFilterParams, k as WPULikeStatsParams, l as WPULikeStats, o as WPULikeCheckParams, p as WPULikeCheckResponse, x as WPULikeVoteParams, n as WPULikeVoteResponse, q as CF7SubmissionResponse, h as WPGraphQLConfig, j as GQLConnection, i as GQLPostFilter, G as GQLPost } from './types-D6rih4G8.cjs';
2
+ export { y as AuthenticationError, B as BlockType, z as CF7Error, D as CF7SubmissionStatus, E as CF7ValidationError, C as CookieConsentCategories, H as CookieConsentConfig, I as EditorBlock, K as EmbeddedAuthor, L as EmbeddedTerm, M as ErrorCode, O as GQLError, Q as GQLPageInfo, S as MediaDetails, V as MediaSize, X as PostEmbedded, Y as SearchResult, Z as TemplatePart, _ as WCDimensions, $ as WCOrderLineItem, a0 as WCProductAttribute, a1 as WCProductDefaultAttribute, a2 as WCShippingLine, a3 as WPGraphQLError, a4 as WPULikeItemType, m as WPULikeStatus, a5 as WooCommerceError, a6 as WooCommercePaginationHeaders, a7 as WordPressAPIError, a8 as createCookieConsentHandler, a9 as defaultMessages, aa as defaultMessagesPl, ab as parseCookieConsent, ac as resolveMessage } from './types-D6rih4G8.cjs';
3
3
 
4
4
  declare function createApplicationPasswordToken(username: string, appPassword: string): string;
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { N as NextWordpressConfig, J as JwtAuthCredentials, r as JwtAuthResponse, a as WooCommerceConfig, d as WooCommerceResponse, W as WordPressResponse, T as Taxonomy, s as WPEntity, R as RenderedTitle, t as RenderedContent, P as Post, A as Author, F as FeaturedMedia, u as WCImage, v as WCProductVariation, b as WCProduct, g as WCCustomer, w as WCAddress, U as UpdateCustomerInput, e as WCCreateOrderInput, f as WCOrder, c as WCProductFilterParams, k as WPULikeStatsParams, l as WPULikeStats, o as WPULikeCheckParams, p as WPULikeCheckResponse, x as WPULikeVoteParams, n as WPULikeVoteResponse, q as CF7SubmissionResponse, h as WPGraphQLConfig, j as GQLConnection, i as GQLPostFilter, G as GQLPost } from './types-COJWPg77.js';
2
- export { y as AuthenticationError, B as BlockType, z as CF7SubmissionStatus, D as CF7ValidationError, C as CookieConsentCategories, E as CookieConsentConfig, H as EditorBlock, I as EmbeddedAuthor, K as EmbeddedTerm, L as ErrorCode, M as GQLError, O as GQLPageInfo, Q as MediaDetails, S as MediaSize, V as PostEmbedded, X as SearchResult, Y as TemplatePart, Z as WCDimensions, _ as WCOrderLineItem, $ as WCProductAttribute, a0 as WCProductDefaultAttribute, a1 as WCShippingLine, a2 as WPGraphQLError, a3 as WPULikeItemType, m as WPULikeStatus, a4 as WooCommerceError, a5 as WooCommercePaginationHeaders, a6 as WordPressAPIError, a7 as createCookieConsentHandler, a8 as defaultMessages, a9 as defaultMessagesPl, aa as parseCookieConsent, ab as resolveMessage } from './types-COJWPg77.js';
1
+ import { N as NextWordpressConfig, J as JwtAuthCredentials, r as JwtAuthResponse, a as WooCommerceConfig, d as WooCommerceResponse, W as WordPressResponse, T as Taxonomy, s as WPEntity, R as RenderedTitle, t as RenderedContent, P as Post, A as Author, F as FeaturedMedia, u as WCImage, v as WCProductVariation, b as WCProduct, g as WCCustomer, w as WCAddress, U as UpdateCustomerInput, e as WCCreateOrderInput, f as WCOrder, c as WCProductFilterParams, k as WPULikeStatsParams, l as WPULikeStats, o as WPULikeCheckParams, p as WPULikeCheckResponse, x as WPULikeVoteParams, n as WPULikeVoteResponse, q as CF7SubmissionResponse, h as WPGraphQLConfig, j as GQLConnection, i as GQLPostFilter, G as GQLPost } from './types-D6rih4G8.js';
2
+ export { y as AuthenticationError, B as BlockType, z as CF7Error, D as CF7SubmissionStatus, E as CF7ValidationError, C as CookieConsentCategories, H as CookieConsentConfig, I as EditorBlock, K as EmbeddedAuthor, L as EmbeddedTerm, M as ErrorCode, O as GQLError, Q as GQLPageInfo, S as MediaDetails, V as MediaSize, X as PostEmbedded, Y as SearchResult, Z as TemplatePart, _ as WCDimensions, $ as WCOrderLineItem, a0 as WCProductAttribute, a1 as WCProductDefaultAttribute, a2 as WCShippingLine, a3 as WPGraphQLError, a4 as WPULikeItemType, m as WPULikeStatus, a5 as WooCommerceError, a6 as WooCommercePaginationHeaders, a7 as WordPressAPIError, a8 as createCookieConsentHandler, a9 as defaultMessages, aa as defaultMessagesPl, ab as parseCookieConsent, ac as resolveMessage } from './types-D6rih4G8.js';
3
3
 
4
4
  declare function createApplicationPasswordToken(username: string, appPassword: string): string;
5
5
 
package/dist/index.js CHANGED
@@ -2133,7 +2133,25 @@ function createWPULikeClient(config) {
2133
2133
  return createWPULikeQueries(fetcher);
2134
2134
  }
2135
2135
 
2136
+ // src/integrations/restApi/contactForm7/types.ts
2137
+ var CF7Error = class extends Error {
2138
+ constructor(code, status, endpoint, message) {
2139
+ super(message);
2140
+ __publicField(this, "code", code);
2141
+ __publicField(this, "status", status);
2142
+ __publicField(this, "endpoint", endpoint);
2143
+ this.name = "CF7Error";
2144
+ }
2145
+ };
2146
+
2136
2147
  // src/integrations/restApi/contactForm7/queries.ts
2148
+ var statusToCode = {
2149
+ mail_sent: ErrorCode.CF7_MAIL_SENT,
2150
+ mail_failed: ErrorCode.CF7_MAIL_FAILED,
2151
+ validation_failed: ErrorCode.CF7_VALIDATION_FAILED,
2152
+ spam: ErrorCode.CF7_SPAM,
2153
+ aborted: ErrorCode.CF7_ABORTED
2154
+ };
2137
2155
  function createCF7Queries(config) {
2138
2156
  async function submitForm(formId, data) {
2139
2157
  const url = buildUrl(config, `/wp-json/contact-form-7/v1/contact-forms/${formId}/feedback`);
@@ -2142,7 +2160,17 @@ function createCF7Queries(config) {
2142
2160
  body.append(key, value);
2143
2161
  }
2144
2162
  const res = await fetch(url, { method: "POST", body, cache: "no-store" });
2145
- return res.json();
2163
+ if (!res.ok) {
2164
+ throw new CF7Error(
2165
+ ErrorCode.CF7_MAIL_FAILED,
2166
+ res.status,
2167
+ url,
2168
+ resolveMessage(ErrorCode.CF7_MAIL_FAILED, config.errorMessages)
2169
+ );
2170
+ }
2171
+ const result = await res.json();
2172
+ const code = statusToCode[result.status];
2173
+ return { ...result, message: resolveMessage(code, config.errorMessages) };
2146
2174
  }
2147
2175
  return { submitForm };
2148
2176
  }
@@ -4327,6 +4355,6 @@ async function validateJwtToken(config, token) {
4327
4355
  return response.ok;
4328
4356
  }
4329
4357
 
4330
- 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 };
4358
+ export { AuthenticationError, CF7Error, 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 };
4331
4359
  //# sourceMappingURL=index.js.map
4332
4360
  //# sourceMappingURL=index.js.map