@sitecore-jss/sitecore-jss-nextjs 21.6.0-canary.9 → 21.7.0-canary.2

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.
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEdgeProxyContentUrl = exports.GraphQLRequestClient = void 0;
4
+ var graphql_1 = require("@sitecore-jss/sitecore-jss/graphql");
5
+ Object.defineProperty(exports, "GraphQLRequestClient", { enumerable: true, get: function () { return graphql_1.GraphQLRequestClient; } });
6
+ Object.defineProperty(exports, "getEdgeProxyContentUrl", { enumerable: true, get: function () { return graphql_1.getEdgeProxyContentUrl; } });
package/dist/cjs/index.js CHANGED
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.NextImage = exports.EditingComponentPlaceholder = exports.Placeholder = exports.RichText = exports.Link = exports.useComponentProps = exports.ComponentPropsContext = exports.ComponentPropsReactContext = exports.normalizeSiteRewrite = exports.getSiteRewriteData = exports.getSiteRewrite = exports.GraphQLSiteInfoService = exports.SiteResolver = exports.GraphQLRobotsService = exports.GraphQLErrorPagesService = exports.GraphQLSitemapXmlService = exports.MultisiteGraphQLSitemapService = exports.GraphQLSitemapService = exports.DisconnectedSitemapService = exports.ComponentPropsService = exports.GraphQLRequestClient = exports.PosResolver = exports.CdpHelper = exports.normalizePersonalizedRewrite = exports.getPersonalizedRewriteData = exports.getPersonalizedRewrite = exports.personalizeLayout = exports.RestDictionaryService = exports.GraphQLDictionaryService = exports.trackingApi = exports.mediaApi = exports.EDITING_COMPONENT_ID = exports.EDITING_COMPONENT_PLACEHOLDER = exports.RenderingType = exports.getFieldValue = exports.getChildPlaceholder = exports.RestLayoutService = exports.GraphQLLayoutService = exports.LayoutServicePageState = exports.tryParseEnvValue = exports.resolveUrl = exports.resetEditorChromes = exports.isEditorActive = exports.getPublicUrl = exports.handleEditorFastRefresh = exports.debug = exports.enableDebug = exports.NativeDataFetcher = exports.AxiosDataFetcher = exports.constants = void 0;
26
+ exports.NextImage = exports.EditingComponentPlaceholder = exports.Placeholder = exports.RichText = exports.Link = exports.useComponentProps = exports.ComponentPropsContext = exports.ComponentPropsReactContext = exports.normalizeSiteRewrite = exports.getSiteRewriteData = exports.getSiteRewrite = exports.GraphQLSiteInfoService = exports.SiteResolver = exports.GraphQLRobotsService = exports.GraphQLErrorPagesService = exports.GraphQLSitemapXmlService = exports.MultisiteGraphQLSitemapService = exports.GraphQLSitemapService = exports.DisconnectedSitemapService = exports.ComponentPropsService = exports.PosResolver = exports.CdpHelper = exports.normalizePersonalizedRewrite = exports.getPersonalizedRewriteData = exports.getPersonalizedRewrite = exports.personalizeLayout = exports.RestDictionaryService = exports.GraphQLDictionaryService = exports.trackingApi = exports.mediaApi = exports.EDITING_COMPONENT_ID = exports.EDITING_COMPONENT_PLACEHOLDER = exports.RenderingType = exports.getFieldValue = exports.getChildPlaceholder = exports.RestLayoutService = exports.GraphQLLayoutService = exports.LayoutServicePageState = exports.tryParseEnvValue = exports.resolveUrl = exports.resetEditorChromes = exports.isEditorActive = exports.getPublicUrl = exports.handleEditorFastRefresh = exports.GraphQLRequestClient = exports.debug = exports.enableDebug = exports.NativeDataFetcher = exports.AxiosDataFetcher = exports.constants = void 0;
27
27
  exports.withDatasourceCheck = exports.withPlaceholder = exports.withEditorChromes = exports.useSitecoreContext = exports.withSitecoreContext = exports.SitecoreContextReactContext = exports.SitecoreContext = exports.VisitorIdentification = exports.File = exports.getFEAASLibraryStylesheetLinks = exports.BYOCComponent = exports.fetchFEaaSComponentServerProps = exports.FEaaSComponent = exports.EditFrame = exports.DateField = exports.Text = exports.Image = exports.ComponentBuilder = exports.BYOCWrapper = exports.FEaaSWrapper = void 0;
28
28
  var sitecore_jss_1 = require("@sitecore-jss/sitecore-jss");
29
29
  Object.defineProperty(exports, "constants", { enumerable: true, get: function () { return sitecore_jss_1.constants; } });
@@ -33,6 +33,7 @@ Object.defineProperty(exports, "enableDebug", { enumerable: true, get: function
33
33
  Object.defineProperty(exports, "debug", { enumerable: true, get: function () { return sitecore_jss_1.debug; } });
34
34
  // we will remove the root exports for these later
35
35
  // we cannot mark exports as deprected directly, so we're using this hack instead
36
+ const graphql_1 = require("./graphql");
36
37
  const utils_1 = require("@sitecore-jss/sitecore-jss/utils");
37
38
  const utils_2 = require("./utils");
38
39
  /** @deprecated use import from '@sitecore-jss/sitecore-jss-nextjs/utils' instead */
@@ -50,6 +51,11 @@ exports.resolveUrl = resolveUrl;
50
51
  exports.tryParseEnvValue = tryParseEnvValue;
51
52
  exports.handleEditorFastRefresh = handleEditorFastRefresh;
52
53
  exports.getPublicUrl = getPublicUrl;
54
+ /** @deprecated use import from '@sitecore-jss/sitecore-jss-nextjs/graphql' instead */
55
+ const { GraphQLRequestClientDep: GraphQLRequestClient } = {
56
+ GraphQLRequestClientDep: graphql_1.GraphQLRequestClient,
57
+ };
58
+ exports.GraphQLRequestClient = GraphQLRequestClient;
53
59
  var layout_1 = require("@sitecore-jss/sitecore-jss/layout");
54
60
  Object.defineProperty(exports, "LayoutServicePageState", { enumerable: true, get: function () { return layout_1.LayoutServicePageState; } });
55
61
  Object.defineProperty(exports, "GraphQLLayoutService", { enumerable: true, get: function () { return layout_1.GraphQLLayoutService; } });
@@ -73,8 +79,6 @@ Object.defineProperty(exports, "getPersonalizedRewriteData", { enumerable: true,
73
79
  Object.defineProperty(exports, "normalizePersonalizedRewrite", { enumerable: true, get: function () { return personalize_1.normalizePersonalizedRewrite; } });
74
80
  Object.defineProperty(exports, "CdpHelper", { enumerable: true, get: function () { return personalize_1.CdpHelper; } });
75
81
  Object.defineProperty(exports, "PosResolver", { enumerable: true, get: function () { return personalize_1.PosResolver; } });
76
- var sitecore_jss_2 = require("@sitecore-jss/sitecore-jss");
77
- Object.defineProperty(exports, "GraphQLRequestClient", { enumerable: true, get: function () { return sitecore_jss_2.GraphQLRequestClient; } });
78
82
  var component_props_service_1 = require("./services/component-props-service");
79
83
  Object.defineProperty(exports, "ComponentPropsService", { enumerable: true, get: function () { return component_props_service_1.ComponentPropsService; } });
80
84
  var disconnected_sitemap_service_1 = require("./services/disconnected-sitemap-service");
@@ -195,6 +195,14 @@ class BaseGraphQLSitemapService {
195
195
  * @returns {GraphQLClient} implementation
196
196
  */
197
197
  getGraphQLClient() {
198
+ if (!this.options.endpoint) {
199
+ if (!this.options.clientFactory) {
200
+ throw new Error('You should provide either an endpoint and apiKey, or a clientFactory.');
201
+ }
202
+ return this.options.clientFactory({
203
+ debugger: sitecore_jss_1.debug.sitemap,
204
+ });
205
+ }
198
206
  return new graphql_1.GraphQLRequestClient(this.options.endpoint, {
199
207
  apiKey: this.options.apiKey,
200
208
  debugger: sitecore_jss_1.debug.sitemap,
@@ -0,0 +1 @@
1
+ export { GraphQLRequestClient, getEdgeProxyContentUrl, } from '@sitecore-jss/sitecore-jss/graphql';
package/dist/esm/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { constants, AxiosDataFetcher, NativeDataFetcher, enableDebug, debug, } from '@sitecore-jss/sitecore-jss';
2
2
  // we will remove the root exports for these later
3
3
  // we cannot mark exports as deprected directly, so we're using this hack instead
4
+ import { GraphQLRequestClient as GraphQLRequestClientDep } from './graphql';
4
5
  import { isEditorActive as isEditorActiveDep, resetEditorChromes as resetEditorChromesDep, resolveUrl as resolveUrlDep, tryParseEnvValue as tryParseEnvValueDep, } from '@sitecore-jss/sitecore-jss/utils';
5
6
  import { handleEditorFastRefresh as handleEditorFastRefreshDep, getPublicUrl as getPublicUrlDep, } from './utils';
6
7
  /** @deprecated use import from '@sitecore-jss/sitecore-jss-nextjs/utils' instead */
@@ -12,6 +13,11 @@ const { isEditorActiveDep: isEditorActive, resetEditorChromesDep: resetEditorChr
12
13
  handleEditorFastRefreshDep,
13
14
  getPublicUrlDep,
14
15
  };
16
+ /** @deprecated use import from '@sitecore-jss/sitecore-jss-nextjs/graphql' instead */
17
+ const { GraphQLRequestClientDep: GraphQLRequestClient } = {
18
+ GraphQLRequestClientDep,
19
+ };
20
+ export { GraphQLRequestClient };
15
21
  export { handleEditorFastRefresh, getPublicUrl };
16
22
  export { isEditorActive, resetEditorChromes, resolveUrl, tryParseEnvValue };
17
23
  export { LayoutServicePageState, GraphQLLayoutService, RestLayoutService, getChildPlaceholder, getFieldValue, RenderingType, EDITING_COMPONENT_PLACEHOLDER, EDITING_COMPONENT_ID, } from '@sitecore-jss/sitecore-jss/layout';
@@ -19,7 +25,6 @@ export { mediaApi } from '@sitecore-jss/sitecore-jss/media';
19
25
  export { trackingApi, } from '@sitecore-jss/sitecore-jss/tracking';
20
26
  export { GraphQLDictionaryService, RestDictionaryService, } from '@sitecore-jss/sitecore-jss/i18n';
21
27
  export { personalizeLayout, getPersonalizedRewrite, getPersonalizedRewriteData, normalizePersonalizedRewrite, CdpHelper, PosResolver, } from '@sitecore-jss/sitecore-jss/personalize';
22
- export { GraphQLRequestClient } from '@sitecore-jss/sitecore-jss';
23
28
  export { ComponentPropsService } from './services/component-props-service';
24
29
  export { DisconnectedSitemapService } from './services/disconnected-sitemap-service';
25
30
  export { GraphQLSitemapService, } from './services/graphql-sitemap-service';
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { GraphQLRequestClient } from '@sitecore-jss/sitecore-jss/graphql';
10
+ import { GraphQLRequestClient, } from '@sitecore-jss/sitecore-jss/graphql';
11
11
  import { debug } from '@sitecore-jss/sitecore-jss';
12
12
  import { getPersonalizedRewrite } from '@sitecore-jss/sitecore-jss/personalize';
13
13
  /** @private */
@@ -191,6 +191,14 @@ export class BaseGraphQLSitemapService {
191
191
  * @returns {GraphQLClient} implementation
192
192
  */
193
193
  getGraphQLClient() {
194
+ if (!this.options.endpoint) {
195
+ if (!this.options.clientFactory) {
196
+ throw new Error('You should provide either an endpoint and apiKey, or a clientFactory.');
197
+ }
198
+ return this.options.clientFactory({
199
+ debugger: debug.sitemap,
200
+ });
201
+ }
194
202
  return new GraphQLRequestClient(this.options.endpoint, {
195
203
  apiKey: this.options.apiKey,
196
204
  debugger: debug.sitemap,
package/graphql.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './types/graphql/index';
package/graphql.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/cjs/graphql/index');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-jss/sitecore-jss-nextjs",
3
- "version": "21.6.0-canary.9",
3
+ "version": "21.7.0-canary.2",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -72,9 +72,9 @@
72
72
  "react-dom": "^18.2.0"
73
73
  },
74
74
  "dependencies": {
75
- "@sitecore-jss/sitecore-jss": "^21.6.0-canary.9",
76
- "@sitecore-jss/sitecore-jss-dev-tools": "^21.6.0-canary.9",
77
- "@sitecore-jss/sitecore-jss-react": "^21.6.0-canary.9",
75
+ "@sitecore-jss/sitecore-jss": "^21.7.0-canary.2",
76
+ "@sitecore-jss/sitecore-jss-dev-tools": "^21.7.0-canary.2",
77
+ "@sitecore-jss/sitecore-jss-react": "^21.7.0-canary.2",
78
78
  "@vercel/kv": "^0.2.1",
79
79
  "node-html-parser": "^6.1.4",
80
80
  "prop-types": "^15.8.1",
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "description": "",
85
85
  "types": "types/index.d.ts",
86
- "gitHead": "3ab62647e284b858de8651b0def11fcafee880e8",
86
+ "gitHead": "78eb7ba8f07b3cdafa181f48700a92f9172f48da",
87
87
  "files": [
88
88
  "dist",
89
89
  "types",
@@ -0,0 +1 @@
1
+ export { GraphQLRequestClient, GraphQLRequestClientFactory, GraphQLRequestClientFactoryConfig, getEdgeProxyContentUrl, } from '@sitecore-jss/sitecore-jss/graphql';
package/types/index.d.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  export { constants, HttpDataFetcher, HttpResponse, AxiosResponse, AxiosDataFetcher, AxiosDataFetcherConfig, NativeDataFetcher, NativeDataFetcherConfig, HTMLLink, enableDebug, debug, } from '@sitecore-jss/sitecore-jss';
2
+ import { GraphQLRequestClient as GraphQLRequestClientDep } from './graphql';
2
3
  import { resolveUrl as resolveUrlDep } from '@sitecore-jss/sitecore-jss/utils';
3
4
  /** @deprecated use import from '@sitecore-jss/sitecore-jss-nextjs/utils' instead */
4
5
  declare const isEditorActive: () => boolean, resetEditorChromes: () => void, resolveUrl: typeof resolveUrlDep, tryParseEnvValue: <T>(envValue: string | undefined, defaultValue: T) => T, handleEditorFastRefresh: (forceReload?: boolean) => void, getPublicUrl: () => string;
6
+ /** @deprecated use import from '@sitecore-jss/sitecore-jss-nextjs/graphql' instead */
7
+ declare const GraphQLRequestClient: typeof GraphQLRequestClientDep;
8
+ export { GraphQLRequestClient };
5
9
  export { handleEditorFastRefresh, getPublicUrl };
6
10
  export { isEditorActive, resetEditorChromes, resolveUrl, tryParseEnvValue };
7
11
  export { LayoutService, LayoutServiceData, LayoutServicePageState, LayoutServiceContext, LayoutServiceContextData, GraphQLLayoutService, GraphQLLayoutServiceConfig, RestLayoutService, RestLayoutServiceConfig, PlaceholderData, PlaceholdersData, RouteData, Field, Item, HtmlElementRendering, getChildPlaceholder, getFieldValue, ComponentRendering, ComponentFields, ComponentParams, RenderingType, EDITING_COMPONENT_PLACEHOLDER, EDITING_COMPONENT_ID, } from '@sitecore-jss/sitecore-jss/layout';
@@ -9,7 +13,6 @@ export { mediaApi } from '@sitecore-jss/sitecore-jss/media';
9
13
  export { trackingApi, TrackingRequestOptions, CampaignInstance, GoalInstance, OutcomeInstance, EventInstance, PageViewInstance, } from '@sitecore-jss/sitecore-jss/tracking';
10
14
  export { DictionaryPhrases, DictionaryService, GraphQLDictionaryService, GraphQLDictionaryServiceConfig, RestDictionaryService, RestDictionaryServiceConfig, } from '@sitecore-jss/sitecore-jss/i18n';
11
15
  export { personalizeLayout, getPersonalizedRewrite, getPersonalizedRewriteData, normalizePersonalizedRewrite, CdpHelper, PosResolver, } from '@sitecore-jss/sitecore-jss/personalize';
12
- export { GraphQLRequestClient } from '@sitecore-jss/sitecore-jss';
13
16
  export { ComponentPropsCollection, ComponentPropsError, GetStaticComponentProps, GetServerSideComponentProps, } from './sharedTypes/component-props';
14
17
  export { ModuleFactory, Module } from './sharedTypes/module-factory';
15
18
  export { ComponentPropsService } from './services/component-props-service';
@@ -1,4 +1,4 @@
1
- import { GraphQLClient, PageInfo } from '@sitecore-jss/sitecore-jss/graphql';
1
+ import { GraphQLClient, GraphQLRequestClientFactory, PageInfo } from '@sitecore-jss/sitecore-jss/graphql';
2
2
  /** @private */
3
3
  export declare const languageError = "The list of languages cannot be empty";
4
4
  export declare const siteError = "The service needs a site name";
@@ -68,17 +68,24 @@ export type RouteListQueryResult = {
68
68
  export interface BaseGraphQLSitemapServiceConfig extends Omit<SiteRouteQueryVariables, 'language' | 'siteName'> {
69
69
  /**
70
70
  * Your Graphql endpoint
71
+ * @deprecated use @param clientFactory property instead
71
72
  */
72
- endpoint: string;
73
+ endpoint?: string;
73
74
  /**
74
75
  * The API key to use for authentication.
76
+ * @deprecated use @param clientFactory property instead
75
77
  */
76
- apiKey: string;
78
+ apiKey?: string;
77
79
  /**
78
80
  * A flag for whether to include personalized routes in service output - only works on XM Cloud
79
81
  * turned off by default
80
82
  */
81
83
  includePersonalizedRoutes?: boolean;
84
+ /**
85
+ * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
86
+ * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
87
+ */
88
+ clientFactory?: GraphQLRequestClientFactory;
82
89
  }
83
90
  /**
84
91
  * Object model of a site page item.