@szymonpiatek/nextwordpress 0.0.19 → 0.0.21
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 +142 -0
- 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 +140 -1
- package/dist/client/index.js.map +1 -1
- package/dist/hooks/index.cjs +142 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +6 -2
- package/dist/hooks/index.d.ts +6 -2
- package/dist/hooks/index.js +140 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +138 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -3
- package/dist/index.d.ts +30 -3
- package/dist/index.js +135 -9
- package/dist/index.js.map +1 -1
- package/dist/server/index.cjs +138 -8
- 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 +135 -9
- package/dist/server/index.js.map +1 -1
- package/dist/{types-DUmH-vcl.d.cts → types-DmNIXJNR.d.cts} +45 -1
- package/dist/{types-DUmH-vcl.d.ts → types-DmNIXJNR.d.ts} +45 -1
- package/package.json +1 -1
package/dist/server/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { 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, YithWishlistError, YithWishlistFetcher, 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, createWishlistMutations, createWishlistQueries, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYithWishlistFetcher, createYoastQueries, extractOmnibusData, resolveBaseUrl, validateJwtToken, withOmnibus, withOmnibusVariation } from '../index.cjs';
|
|
1
|
+
export { X as AddProductToTIWishlistInput, Q as AddProductToWishlistInput, a2 as AuthenticationError, E as Author, a3 as BlockType, a4 as CF7Error, x as CF7SubmissionResponse, a5 as CF7SubmissionStatus, a6 as CF7ValidationError, C as CookieConsentCategories, a7 as CookieConsentConfig, S as CreateTIWishlistInput, M as CreateWishlistInput, a8 as EditorBlock, a9 as EmbeddedAuthor, aa as EmbeddedTerm, L as ErrorCode, F as FeaturedMedia, q as GQLConnection, ab as GQLError, ac as GQLPageInfo, o as GQLPost, p as GQLPostFilter, a1 as GQLResetUserPasswordInput, a as GQLResetUserPasswordResult, a0 as GQLSendPasswordResetEmailInput, G as GQLSendPasswordResetEmailResult, m as GetTIWishlistProductsParams, J as JwtAuthCredentials, y as JwtAuthResponse, ad as MediaDetails, ae as MediaSize, N as NextWordpressConfig, P as Post, af as PostEmbedded, D as RenderedContent, B as RenderedTitle, ag as SearchResult, l as TIWishlist, T as TIWishlistConfig, n as TIWishlistItem, z as Taxonomy, ah as TemplatePart, U as UpdateCustomerInput, V as UpdateTIWishlistInput, O as UpdateWishlistInput, _ as WCAddress, h as WCCreateOrderInput, j as WCCustomer, ai as WCDimensions, K as WCImage, i as WCOrder, aj as WCOrderLineItem, e as WCProduct, ak as WCProductAttribute, al as WCProductDefaultAttribute, f as WCProductFilterParams, Z as WCProductVariation, am as WCShippingLine, k as WCWishlist, an as WCWishlistItem, A as WPEntity, W as WPGraphQLConfig, ao as WPGraphQLError, v as WPULikeCheckParams, w as WPULikeCheckResponse, ap as WPULikeItemType, s as WPULikeStats, r as WPULikeStatsParams, t as WPULikeStatus, $ as WPULikeVoteParams, u as WPULikeVoteResponse, d as WooCommerceConfig, aq as WooCommerceError, ar as WooCommercePaginationHeaders, g as WooCommerceResponse, as as WordPressAPIError, Y as YithWishlistConfig, at as createCookieConsentHandler, au as defaultMessages, av as defaultMessagesPl, aw as parseCookieConsent, ax as resolveMessage } from '../types-DmNIXJNR.cjs';
|
|
2
|
+
export { 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, TIWishlistError, TIWishlistFetcher, 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, YithWishlistError, YithWishlistFetcher, authenticateJwt, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createApplicationPasswordToken, createAuthorsMutations, createCF7Queries, createCPTQueries, createCategoriesMutations, createCommentsMutations, createFaustAuthHandler, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createPreviewHandler, createRevalidationHandler, createTIWishlistFetcher, createTIWishlistMutations, createTIWishlistQueries, createTagsMutations, createWPGraphQLClient, createWPGraphQLClient as createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWPULikeClient, createWPULikeQueries, createWishlistMutations, createWishlistQueries, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYithWishlistFetcher, createYoastQueries, extractOmnibusData, resolveBaseUrl, validateJwtToken, withOmnibus, withOmnibusVariation } from '../index.cjs';
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { 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, YithWishlistError, YithWishlistFetcher, 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, createWishlistMutations, createWishlistQueries, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYithWishlistFetcher, createYoastQueries, extractOmnibusData, resolveBaseUrl, validateJwtToken, withOmnibus, withOmnibusVariation } from '../index.js';
|
|
1
|
+
export { X as AddProductToTIWishlistInput, Q as AddProductToWishlistInput, a2 as AuthenticationError, E as Author, a3 as BlockType, a4 as CF7Error, x as CF7SubmissionResponse, a5 as CF7SubmissionStatus, a6 as CF7ValidationError, C as CookieConsentCategories, a7 as CookieConsentConfig, S as CreateTIWishlistInput, M as CreateWishlistInput, a8 as EditorBlock, a9 as EmbeddedAuthor, aa as EmbeddedTerm, L as ErrorCode, F as FeaturedMedia, q as GQLConnection, ab as GQLError, ac as GQLPageInfo, o as GQLPost, p as GQLPostFilter, a1 as GQLResetUserPasswordInput, a as GQLResetUserPasswordResult, a0 as GQLSendPasswordResetEmailInput, G as GQLSendPasswordResetEmailResult, m as GetTIWishlistProductsParams, J as JwtAuthCredentials, y as JwtAuthResponse, ad as MediaDetails, ae as MediaSize, N as NextWordpressConfig, P as Post, af as PostEmbedded, D as RenderedContent, B as RenderedTitle, ag as SearchResult, l as TIWishlist, T as TIWishlistConfig, n as TIWishlistItem, z as Taxonomy, ah as TemplatePart, U as UpdateCustomerInput, V as UpdateTIWishlistInput, O as UpdateWishlistInput, _ as WCAddress, h as WCCreateOrderInput, j as WCCustomer, ai as WCDimensions, K as WCImage, i as WCOrder, aj as WCOrderLineItem, e as WCProduct, ak as WCProductAttribute, al as WCProductDefaultAttribute, f as WCProductFilterParams, Z as WCProductVariation, am as WCShippingLine, k as WCWishlist, an as WCWishlistItem, A as WPEntity, W as WPGraphQLConfig, ao as WPGraphQLError, v as WPULikeCheckParams, w as WPULikeCheckResponse, ap as WPULikeItemType, s as WPULikeStats, r as WPULikeStatsParams, t as WPULikeStatus, $ as WPULikeVoteParams, u as WPULikeVoteResponse, d as WooCommerceConfig, aq as WooCommerceError, ar as WooCommercePaginationHeaders, g as WooCommerceResponse, as as WordPressAPIError, Y as YithWishlistConfig, at as createCookieConsentHandler, au as defaultMessages, av as defaultMessagesPl, aw as parseCookieConsent, ax as resolveMessage } from '../types-DmNIXJNR.js';
|
|
2
|
+
export { 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, TIWishlistError, TIWishlistFetcher, 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, YithWishlistError, YithWishlistFetcher, authenticateJwt, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createApplicationPasswordToken, createAuthorsMutations, createCF7Queries, createCPTQueries, createCategoriesMutations, createCommentsMutations, createFaustAuthHandler, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createPreviewHandler, createRevalidationHandler, createTIWishlistFetcher, createTIWishlistMutations, createTIWishlistQueries, createTagsMutations, createWPGraphQLClient, createWPGraphQLClient as createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWPULikeClient, createWPULikeQueries, createWishlistMutations, createWishlistQueries, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYithWishlistFetcher, createYoastQueries, extractOmnibusData, resolveBaseUrl, validateJwtToken, withOmnibus, withOmnibusVariation } from '../index.js';
|
package/dist/server/index.js
CHANGED
|
@@ -941,6 +941,132 @@ function createWishlistMutations(fetcher) {
|
|
|
941
941
|
};
|
|
942
942
|
}
|
|
943
943
|
|
|
944
|
+
// src/integrations/restApi/woocommerce/ti_wishlist/fetcher.ts
|
|
945
|
+
var USER_AGENT3 = "NextWordpress TI Wishlist Client";
|
|
946
|
+
var DEFAULT_CACHE_TTL2 = 3600;
|
|
947
|
+
var TIWishlistError = class extends Error {
|
|
948
|
+
constructor(code, status, url, message) {
|
|
949
|
+
super(message);
|
|
950
|
+
__publicField(this, "code", code);
|
|
951
|
+
__publicField(this, "status", status);
|
|
952
|
+
__publicField(this, "url", url);
|
|
953
|
+
this.name = "TIWishlistError";
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
function resolveTIErrorCode(status) {
|
|
957
|
+
if (status === 401) return ErrorCode.WOO_UNAUTHORIZED;
|
|
958
|
+
if (status === 403) return ErrorCode.WOO_FORBIDDEN;
|
|
959
|
+
if (status === 404) return ErrorCode.WOO_WISHLIST_NOT_FOUND;
|
|
960
|
+
return ErrorCode.WOO_REQUEST_FAILED;
|
|
961
|
+
}
|
|
962
|
+
function createTIWishlistFetcher(config) {
|
|
963
|
+
const cacheTTL = config.cacheTTL ?? DEFAULT_CACHE_TTL2;
|
|
964
|
+
function buildUrl2(path) {
|
|
965
|
+
const base = typeof window !== "undefined" && config.clientURL ? config.clientURL : config.serverURL;
|
|
966
|
+
return `${base}${path}`;
|
|
967
|
+
}
|
|
968
|
+
function authHeaders() {
|
|
969
|
+
return {
|
|
970
|
+
"User-Agent": USER_AGENT3,
|
|
971
|
+
"Content-Type": "application/json",
|
|
972
|
+
Authorization: `Bearer ${config.token}`
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
async function throwTIError(response, url) {
|
|
976
|
+
const errorCode = resolveTIErrorCode(response.status);
|
|
977
|
+
throw new TIWishlistError(
|
|
978
|
+
errorCode,
|
|
979
|
+
response.status,
|
|
980
|
+
url,
|
|
981
|
+
resolveMessage(errorCode, config.errorMessages)
|
|
982
|
+
);
|
|
983
|
+
}
|
|
984
|
+
async function tiFetch(path, tags = ["ti-wishlist"], options) {
|
|
985
|
+
const url = buildUrl2(path);
|
|
986
|
+
const isMutation = options?.method && options.method !== "GET";
|
|
987
|
+
const response = await fetch(url, {
|
|
988
|
+
...options,
|
|
989
|
+
headers: {
|
|
990
|
+
...authHeaders(),
|
|
991
|
+
...options?.headers
|
|
992
|
+
},
|
|
993
|
+
next: isMutation ? void 0 : { tags, revalidate: cacheTTL }
|
|
994
|
+
});
|
|
995
|
+
if (!response.ok) {
|
|
996
|
+
await throwTIError(response, url);
|
|
997
|
+
}
|
|
998
|
+
return response.json();
|
|
999
|
+
}
|
|
1000
|
+
async function tiFetchGraceful(path, fallback, tags = ["ti-wishlist"]) {
|
|
1001
|
+
try {
|
|
1002
|
+
return await tiFetch(path, tags);
|
|
1003
|
+
} catch (err) {
|
|
1004
|
+
console.warn(`TI Wishlist fetch failed for ${path}`, err);
|
|
1005
|
+
return fallback;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
async function tiMutate(path, body, method = "POST") {
|
|
1009
|
+
return tiFetch(path, ["ti-wishlist"], {
|
|
1010
|
+
method,
|
|
1011
|
+
body: JSON.stringify(body)
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
return { tiFetch, tiFetchGraceful, tiMutate };
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
// src/integrations/restApi/woocommerce/ti_wishlist/queries.ts
|
|
1018
|
+
var BASE3 = "/wp-json/wc/v3/wishlist";
|
|
1019
|
+
function createTIWishlistQueries(fetcher) {
|
|
1020
|
+
const { tiFetch, tiFetchGraceful } = fetcher;
|
|
1021
|
+
async function getWishlistsByUser(userId) {
|
|
1022
|
+
return tiFetchGraceful(
|
|
1023
|
+
`${BASE3}/get_by_user/${userId}`,
|
|
1024
|
+
[],
|
|
1025
|
+
["ti-wishlist", `ti-wishlists-user-${userId}`]
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
async function getWishlistByShareKey(shareKey) {
|
|
1029
|
+
return tiFetch(`${BASE3}/get_by_share_key/${shareKey}`, [
|
|
1030
|
+
"ti-wishlist",
|
|
1031
|
+
`ti-wishlist-${shareKey}`
|
|
1032
|
+
]);
|
|
1033
|
+
}
|
|
1034
|
+
async function getWishlistProducts(shareKey, params) {
|
|
1035
|
+
const query = new URLSearchParams();
|
|
1036
|
+
if (params?.count != null) query.set("count", String(params.count));
|
|
1037
|
+
if (params?.offset != null) query.set("offset", String(params.offset));
|
|
1038
|
+
if (params?.order != null) query.set("order", params.order);
|
|
1039
|
+
const qs = query.toString() ? `?${query.toString()}` : "";
|
|
1040
|
+
return tiFetch(`${BASE3}/${shareKey}/get_products${qs}`, [
|
|
1041
|
+
"ti-wishlist",
|
|
1042
|
+
`ti-wishlist-products-${shareKey}`
|
|
1043
|
+
]);
|
|
1044
|
+
}
|
|
1045
|
+
return { getWishlistsByUser, getWishlistByShareKey, getWishlistProducts };
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
// src/integrations/restApi/woocommerce/ti_wishlist/mutations.ts
|
|
1049
|
+
var BASE4 = "/wp-json/wc/v3/wishlist";
|
|
1050
|
+
function createTIWishlistMutations(fetcher) {
|
|
1051
|
+
const { tiFetch, tiMutate } = fetcher;
|
|
1052
|
+
async function createWishlist(input) {
|
|
1053
|
+
return tiMutate(`${BASE4}/create`, input);
|
|
1054
|
+
}
|
|
1055
|
+
async function updateWishlist(shareKey, input) {
|
|
1056
|
+
return tiMutate(`${BASE4}/update/${shareKey}`, input);
|
|
1057
|
+
}
|
|
1058
|
+
async function deleteWishlist(shareKey) {
|
|
1059
|
+
return tiFetch(`${BASE4}/delete/${shareKey}`, ["ti-wishlist"]);
|
|
1060
|
+
}
|
|
1061
|
+
async function addProduct(shareKey, input) {
|
|
1062
|
+
return tiMutate(`${BASE4}/${shareKey}/add_product`, input);
|
|
1063
|
+
}
|
|
1064
|
+
async function removeProduct(shareKey, itemId) {
|
|
1065
|
+
return tiMutate(`${BASE4}/${shareKey}/remove_product/${itemId}`, {}, "DELETE");
|
|
1066
|
+
}
|
|
1067
|
+
return { createWishlist, updateWishlist, deleteWishlist, addProduct, removeProduct };
|
|
1068
|
+
}
|
|
1069
|
+
|
|
944
1070
|
// src/integrations/restApi/woocommerce/omnibus/queries.ts
|
|
945
1071
|
var META_KEY_LOWEST_PRICE = "wpo_lowest_price";
|
|
946
1072
|
var META_KEY_PRICE_HISTORY = "_alg_wc_price_history";
|
|
@@ -1007,8 +1133,8 @@ function resolveWooErrorCode(status, upstreamCode) {
|
|
|
1007
1133
|
}
|
|
1008
1134
|
|
|
1009
1135
|
// src/integrations/restApi/woocommerce/client/fetcher.ts
|
|
1010
|
-
var
|
|
1011
|
-
var
|
|
1136
|
+
var USER_AGENT4 = "NextWordpress WooCommerce Client";
|
|
1137
|
+
var DEFAULT_CACHE_TTL3 = 3600;
|
|
1012
1138
|
function toQueryString(params) {
|
|
1013
1139
|
const pairs = [];
|
|
1014
1140
|
for (const [key, value] of Object.entries(params)) {
|
|
@@ -1018,7 +1144,7 @@ function toQueryString(params) {
|
|
|
1018
1144
|
return pairs.join("&");
|
|
1019
1145
|
}
|
|
1020
1146
|
function createWooCommerceFetcher(config) {
|
|
1021
|
-
const cacheTTL = config.cacheTTL ??
|
|
1147
|
+
const cacheTTL = config.cacheTTL ?? DEFAULT_CACHE_TTL3;
|
|
1022
1148
|
function withAuth(query) {
|
|
1023
1149
|
return { ...query, consumer_key: config.consumerKey, consumer_secret: config.consumerSecret };
|
|
1024
1150
|
}
|
|
@@ -1045,7 +1171,7 @@ function createWooCommerceFetcher(config) {
|
|
|
1045
1171
|
const response = await fetch(url, {
|
|
1046
1172
|
...options,
|
|
1047
1173
|
headers: {
|
|
1048
|
-
"User-Agent":
|
|
1174
|
+
"User-Agent": USER_AGENT4,
|
|
1049
1175
|
"Content-Type": "application/json",
|
|
1050
1176
|
...options?.headers
|
|
1051
1177
|
},
|
|
@@ -1067,7 +1193,7 @@ function createWooCommerceFetcher(config) {
|
|
|
1067
1193
|
async function wcFetchPaginated(path, query, tags = ["woocommerce"]) {
|
|
1068
1194
|
const url = buildUrl2(path, query);
|
|
1069
1195
|
const response = await fetch(url, {
|
|
1070
|
-
headers: { "User-Agent":
|
|
1196
|
+
headers: { "User-Agent": USER_AGENT4 },
|
|
1071
1197
|
next: { tags, revalidate: cacheTTL }
|
|
1072
1198
|
});
|
|
1073
1199
|
if (!response.ok) {
|
|
@@ -2353,7 +2479,7 @@ var WPGraphQLError = class extends Error {
|
|
|
2353
2479
|
};
|
|
2354
2480
|
|
|
2355
2481
|
// src/integrations/wpGraphQL/client/fetcher.ts
|
|
2356
|
-
var
|
|
2482
|
+
var USER_AGENT5 = "NextWordpress WPGraphQL Client";
|
|
2357
2483
|
function createWPGraphQLFetcher(config) {
|
|
2358
2484
|
const url = `${resolveBaseUrl(config)}/graphql`;
|
|
2359
2485
|
const cacheTTL = config.cacheTTL ?? 300;
|
|
@@ -2362,7 +2488,7 @@ function createWPGraphQLFetcher(config) {
|
|
|
2362
2488
|
method: "POST",
|
|
2363
2489
|
headers: {
|
|
2364
2490
|
"Content-Type": "application/json",
|
|
2365
|
-
"User-Agent":
|
|
2491
|
+
"User-Agent": USER_AGENT5
|
|
2366
2492
|
},
|
|
2367
2493
|
body: JSON.stringify({ query: document, variables }),
|
|
2368
2494
|
next: { tags, revalidate: cacheTTL }
|
|
@@ -2406,7 +2532,7 @@ function createWPGraphQLFetcher(config) {
|
|
|
2406
2532
|
async function gqlMutate(document, variables, authToken) {
|
|
2407
2533
|
const headers = {
|
|
2408
2534
|
"Content-Type": "application/json",
|
|
2409
|
-
"User-Agent":
|
|
2535
|
+
"User-Agent": USER_AGENT5
|
|
2410
2536
|
};
|
|
2411
2537
|
if (authToken) {
|
|
2412
2538
|
headers["Authorization"] = authToken;
|
|
@@ -4557,6 +4683,6 @@ async function validateJwtToken(config, token) {
|
|
|
4557
4683
|
return response.ok;
|
|
4558
4684
|
}
|
|
4559
4685
|
|
|
4560
|
-
export { AuthenticationError, CF7Error, ErrorCode, WPGraphQLError, WooCommerceError, WordPressAPIError, YithWishlistError, 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, createWishlistMutations, createWishlistQueries, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYithWishlistFetcher, createYoastQueries, defaultMessages, defaultMessagesPl, extractOmnibusData, parseCookieConsent, resolveBaseUrl, resolveMessage, validateJwtToken, withOmnibus, withOmnibusVariation };
|
|
4686
|
+
export { AuthenticationError, CF7Error, ErrorCode, TIWishlistError, WPGraphQLError, WooCommerceError, WordPressAPIError, YithWishlistError, authenticateJwt, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createApplicationPasswordToken, createAuthorsMutations, createCF7Queries, createCPTQueries, createCategoriesMutations, createCommentsMutations, createCookieConsentHandler, createFaustAuthHandler, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createPreviewHandler, createRevalidationHandler, createTIWishlistFetcher, createTIWishlistMutations, createTIWishlistQueries, createTagsMutations, createWPGraphQLCoreClient as createWPGraphQLClient, createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWPULikeClient, createWPULikeQueries, createWishlistMutations, createWishlistQueries, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYithWishlistFetcher, createYoastQueries, defaultMessages, defaultMessagesPl, extractOmnibusData, parseCookieConsent, resolveBaseUrl, resolveMessage, validateJwtToken, withOmnibus, withOmnibusVariation };
|
|
4561
4687
|
//# sourceMappingURL=index.js.map
|
|
4562
4688
|
//# sourceMappingURL=index.js.map
|