Hello @Priyanka, thanks for reply.
Yes:
package.json
"dependencies": {
"@fingerprintjs/fingerprintjs": "3.3.3",
"@grupoboticario/flora": "^0.15.0",
"@grupoboticario/flora-react": "^0.10.13",
"@grupoboticario/flora-screenrecording-addon": "^2.3.0",
"@hookform/resolvers": "^2.8.8",
"@loadable/component": "^5.15.2",
"@newrelic/next": "^0.1.1",
"@prismicio/client": "^6.4.3",
"@prismicio/helpers": "^2.3.0",
"@prismicio/react": "^2.3.0",
"@prismicio/next": "^0.1.2",
"@radix-ui/react-collapsible": "^0.1.6",
"axios": "^0.26.1",
"cache-manager": "^3.6.1",
"newrelic": "^8.9.1",
"next": "^12.1.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-google-login": "^5.2.2",
"react-hook-form": "^7.30.0",
"react-icons": "^4.3.1",
"react-loadable-visibility": "^3.0.2",
"react-swipeable": "^6.2.1",
"sitemap": "^7.1.1",
"tldts": "^5.7.76",
"uuid": "^8.3.2",
"winston": "^3.7.2",
"yup": "^0.32.11"
},
"devDependencies": {
"@prismicio/types": "^0.1.27",
"@release-it/bumper": "^3.0.1",
"@testing-library/dom": "^8.13.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.1.5",
"@testing-library/react-hooks": "^8.0.0",
"@testing-library/user-event": "^14.1.1",
"@types/cache-manager": "^3.4.3",
"@types/jest": "^27.4.1",
"@types/jest-when": "^3.5.0",
"@types/newrelic": "^7.0.3",
"@types/node": "^17.0.24",
"@types/react": "^18.0.5",
"@types/react-loadable-visibility": "^3.0.2",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^5.19.0",
"@typescript-eslint/parser": "^5.20.0",
"canvas": "^2.9.1",
"eslint": "<9.0.0",
"eslint-config-next": "^12.1.5",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^26.1.4",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.4.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-sonarjs": "^0.13.0",
"husky": "^7.0.4",
"jest": "^27.5.1",
"jest-axe": "^6.0.0",
"jest-watch-typeahead": "^1.0.0",
"jest-when": "^3.5.1",
"lint-staged": "^12.3.8",
"marked": "^4.0.14",
"news-fragments": "1.14.2",
"nock": "^13.2.4",
"node-mocks-http": "^1.11.0",
"prettier": "^2.6.2",
"release-it": "^14.14.2",
"slice-machine-ui": "^0.3.7",
"std-mocks": "^1.0.1",
"typescript": "4.5.5"
}
prismic.js
import * as prismic from '@prismicio/client';
import sm from './sm.json';
export const endpoint = sm.apiEndpoint;
export const repositoryName = prismic.getRepositoryName(endpoint);
export function linkResolver(doc) {
switch (doc.type) {
case 'home':
return '/';
case 'lp':
return `/${doc.uid}`;
case 'signup':
return '/inscricao';
case 'already-signup':
return '/status/cadastro-existente';
case 'success':
return '/status/sucesso';
default:
return '/';
}
}
We did not use the client in this same file as we had already implemented this configuration so that our token would remain private (not exposed) from use in SSR.
However, we did tests also implementing the client from prismic.js, as per the documentation and the problem remains, so I believe something else could be causing this loop of redirects
Here is our client implementation:
import * as prismic from '@prismicio/client';
import { enableAutoPreviews } from '@prismicio/next';
export function getPrismicClient(
apiUrl: string,
accessToken: string,
config: any,
) {
const client = prismic.createClient(apiUrl, {
...config,
accessToken,
});
enableAutoPreviews({
client,
...config,
});
return client;
}
And our searches for content are done through predicates:
const prismicClient = getPrismicClient(
this.apiUrl,
this.accessToken,
this.previewData,
);
const tag = multibrand ? 'multimarca' : businessUnit;
const { results } = await prismicClient.get({
predicates: [
prismic.predicate.at(predicatePath, predicateValue),
prismic.predicate.any('document.tags', [tag]),
],
});