@payloadcms/next 3.0.0-beta.6 → 3.0.0-beta.9
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/layouts/Root/index.d.ts.map +1 -1
- package/dist/layouts/Root/index.js +17 -0
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/prod/styles.css +1 -1
- package/dist/routes/rest/auth/logout.js +1 -1
- package/dist/routes/rest/auth/logout.js.map +1 -1
- package/dist/routes/rest/routeError.d.ts.map +1 -1
- package/dist/routes/rest/routeError.js.map +1 -1
- package/dist/scss/app.scss +2 -3
- package/dist/scss/vars.scss +0 -7
- package/dist/utilities/getDataAndFile.d.ts.map +1 -1
- package/dist/utilities/getDataAndFile.js +5 -1
- package/dist/utilities/getDataAndFile.js.map +1 -1
- package/package.json +7 -7
- package/dist/prod/payload/SuisseIntl-Bold.woff +0 -0
- package/dist/prod/payload/SuisseIntl-Bold.woff2 +0 -0
- package/dist/prod/payload/SuisseIntl-Medium.woff +0 -0
- package/dist/prod/payload/SuisseIntl-Medium.woff2 +0 -0
- package/dist/prod/payload/SuisseIntl-SemiBold.woff +0 -0
- package/dist/prod/payload/SuisseIntl-SemiBold.woff2 +0 -0
- package/dist/prod/payload/SuisseIntl.woff +0 -0
- package/dist/prod/payload/SuisseIntl.woff2 +0 -0
- package/dist/prod/payload/merriweather-v30-latin-900.woff +0 -0
- package/dist/prod/payload/merriweather-v30-latin-900.woff2 +0 -0
- package/dist/prod/payload/merriweather-v30-latin-900italic.woff +0 -0
- package/dist/prod/payload/merriweather-v30-latin-900italic.woff2 +0 -0
- package/dist/prod/payload/merriweather-v30-latin-italic.woff +0 -0
- package/dist/prod/payload/merriweather-v30-latin-italic.woff2 +0 -0
- package/dist/prod/payload/merriweather-v30-latin-regular.woff +0 -0
- package/dist/prod/payload/merriweather-v30-latin-regular.woff2 +0 -0
- package/dist/scss/fonts.scss +0 -75
|
@@ -2,7 +2,7 @@ import httpStatus from 'http-status';
|
|
|
2
2
|
import { generateExpiredPayloadCookie } from 'payload/auth';
|
|
3
3
|
import { logoutOperation } from 'payload/operations';
|
|
4
4
|
export const logout = async ({ collection, req })=>{
|
|
5
|
-
const result = logoutOperation({
|
|
5
|
+
const result = await logoutOperation({
|
|
6
6
|
collection,
|
|
7
7
|
req
|
|
8
8
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/routes/rest/auth/logout.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generateExpiredPayloadCookie } from 'payload/auth'\nimport { logoutOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nexport const logout: CollectionRouteHandler = async ({ collection, req }) => {\n const result = logoutOperation({\n collection,\n req,\n })\n\n if (!result) {\n return Response.json(\n {\n message: 'Logout failed.',\n },\n {\n status: httpStatus.BAD_REQUEST,\n },\n )\n }\n\n const expiredCookie = generateExpiredPayloadCookie({\n collectionConfig: collection.config,\n payload: req.payload,\n })\n\n return Response.json(\n {\n // TODO(translate)\n message: 'Logout successful.',\n },\n {\n headers: new Headers({\n 'Set-Cookie': expiredCookie,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","generateExpiredPayloadCookie","logoutOperation","logout","collection","req","result","Response","json","message","status","BAD_REQUEST","expiredCookie","collectionConfig","config","payload","headers","Headers","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,4BAA4B,QAAQ,eAAc;AAC3D,SAASC,eAAe,QAAQ,qBAAoB;AAIpD,OAAO,MAAMC,SAAiC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACtE,MAAMC,
|
|
1
|
+
{"version":3,"sources":["../../../../src/routes/rest/auth/logout.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generateExpiredPayloadCookie } from 'payload/auth'\nimport { logoutOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nexport const logout: CollectionRouteHandler = async ({ collection, req }) => {\n const result = await logoutOperation({\n collection,\n req,\n })\n\n if (!result) {\n return Response.json(\n {\n message: 'Logout failed.',\n },\n {\n status: httpStatus.BAD_REQUEST,\n },\n )\n }\n\n const expiredCookie = generateExpiredPayloadCookie({\n collectionConfig: collection.config,\n payload: req.payload,\n })\n\n return Response.json(\n {\n // TODO(translate)\n message: 'Logout successful.',\n },\n {\n headers: new Headers({\n 'Set-Cookie': expiredCookie,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","generateExpiredPayloadCookie","logoutOperation","logout","collection","req","result","Response","json","message","status","BAD_REQUEST","expiredCookie","collectionConfig","config","payload","headers","Headers","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,4BAA4B,QAAQ,eAAc;AAC3D,SAASC,eAAe,QAAQ,qBAAoB;AAIpD,OAAO,MAAMC,SAAiC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACtE,MAAMC,SAAS,MAAMJ,gBAAgB;QACnCE;QACAC;IACF;IAEA,IAAI,CAACC,QAAQ;QACX,OAAOC,SAASC,IAAI,CAClB;YACEC,SAAS;QACX,GACA;YACEC,QAAQV,WAAWW,WAAW;QAChC;IAEJ;IAEA,MAAMC,gBAAgBX,6BAA6B;QACjDY,kBAAkBT,WAAWU,MAAM;QACnCC,SAASV,IAAIU,OAAO;IACtB;IAEA,OAAOR,SAASC,IAAI,CAClB;QACE,kBAAkB;QAClBC,SAAS;IACX,GACA;QACEO,SAAS,IAAIC,QAAQ;YACnB,cAAcL;QAChB;QACAF,QAAQV,WAAWkB,EAAE;IACvB;AAEJ,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routeError.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/routeError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAG/D,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"routeError.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/routeError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAG/D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,CAAC,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AA+D7E,eAAO,MAAM,UAAU,8BAIpB;IACD,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,GAAG,EAAE,QAAQ,CAAA;IACb,GAAG,EAAE,cAAc,CAAA;CACpB,aAmDA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/routes/rest/routeError.ts"],"sourcesContent":["import type { Collection, PayloadRequest } from 'payload/types'\n\nimport httpStatus from 'http-status'\nimport { APIError
|
|
1
|
+
{"version":3,"sources":["../../../src/routes/rest/routeError.ts"],"sourcesContent":["import type { Collection, PayloadRequest } from 'payload/types'\n\nimport httpStatus from 'http-status'\nimport { APIError } from 'payload/errors'\n\nexport type ErrorResponse = { data?: any; errors: unknown[]; stack?: string }\n\nconst formatErrors = (incoming: { [key: string]: unknown } | APIError): ErrorResponse => {\n if (incoming) {\n // Cannot use `instanceof` to check error type: https://github.com/microsoft/TypeScript/issues/13965\n // Instead, get the prototype of the incoming error and check its constructor name\n const proto = Object.getPrototypeOf(incoming)\n\n // Payload 'ValidationError' and 'APIError'\n if (\n (proto.constructor.name === 'ValidationError' || proto.constructor.name === 'APIError') &&\n incoming.data\n ) {\n return {\n errors: [\n {\n name: incoming.name,\n data: incoming.data,\n message: incoming.message,\n },\n ],\n }\n }\n\n // Mongoose 'ValidationError': https://mongoosejs.com/docs/api/error.html#Error.ValidationError\n if (proto.constructor.name === 'ValidationError' && 'errors' in incoming && incoming.errors) {\n return {\n errors: Object.keys(incoming.errors).reduce((acc, key) => {\n acc.push({\n field: incoming.errors[key].path,\n message: incoming.errors[key].message,\n })\n return acc\n }, []),\n }\n }\n\n if (Array.isArray(incoming.message)) {\n return {\n errors: incoming.message,\n }\n }\n\n if (incoming.name) {\n return {\n errors: [\n {\n message: incoming.message,\n },\n ],\n }\n }\n }\n\n return {\n errors: [\n {\n message: 'An unknown error occurred.',\n },\n ],\n }\n}\n\nexport const routeError = ({\n collection,\n err,\n req,\n}: {\n collection?: Collection\n err: APIError\n req: PayloadRequest\n}) => {\n if (!req?.payload) {\n return Response.json(\n {\n message: err.message,\n stack: err.stack,\n },\n { status: httpStatus.INTERNAL_SERVER_ERROR },\n )\n }\n\n const { config, logger } = req.payload\n\n let response = formatErrors(err)\n\n let status = err.status || httpStatus.INTERNAL_SERVER_ERROR\n\n logger.error(err.stack)\n\n // Internal server errors can contain anything, including potentially sensitive data.\n // Therefore, error details will be hidden from the response unless `config.debug` is `true`\n if (!config.debug && status === httpStatus.INTERNAL_SERVER_ERROR) {\n response = formatErrors(new APIError('Something went wrong.'))\n }\n\n if (config.debug && config.debug === true) {\n response.stack = err.stack\n }\n\n if (collection && typeof collection.config.hooks.afterError === 'function') {\n ;({ response, status } = collection.config.hooks.afterError(\n err,\n response,\n req.context,\n collection.config,\n ) || { response, status })\n }\n\n if (typeof config.hooks.afterError === 'function') {\n ;({ response, status } = config.hooks.afterError(\n err,\n response,\n req.context,\n collection?.config,\n ) || {\n response,\n status,\n })\n }\n\n return Response.json(response, { status })\n}\n"],"names":["httpStatus","APIError","formatErrors","incoming","proto","Object","getPrototypeOf","constructor","name","data","errors","message","keys","reduce","acc","key","push","field","path","Array","isArray","routeError","collection","err","req","payload","Response","json","stack","status","INTERNAL_SERVER_ERROR","config","logger","response","error","debug","hooks","afterError","context"],"rangeMappings":";;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C,EAAC"}
|
package/dist/scss/app.scss
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
@import './fonts.scss';
|
|
2
1
|
@import './styles.scss';
|
|
3
2
|
@import './toastify.scss';
|
|
4
3
|
@import './colors.scss';
|
|
@@ -20,9 +19,9 @@
|
|
|
20
19
|
--theme-overlay: rgba(5, 5, 5, 0.5);
|
|
21
20
|
--theme-baseline: #{$baseline-px};
|
|
22
21
|
--theme-baseline-body-size: #{$baseline-body-size};
|
|
23
|
-
--font-body: '
|
|
22
|
+
--font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
23
|
+
sans-serif;
|
|
24
24
|
--font-mono: monospace;
|
|
25
|
-
--font-serif: 'Merriweather', serif;
|
|
26
25
|
|
|
27
26
|
--style-radius-s: #{$style-radius-s};
|
|
28
27
|
--style-radius-m: #{$style-radius-m};
|
package/dist/scss/vars.scss
CHANGED
|
@@ -21,13 +21,6 @@ $baseline: math.div($baseline-px, $baseline-body-size) + rem;
|
|
|
21
21
|
@return (math.div($baseline-px, $baseline-body-size) * $multiplier) + rem;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
//////////////////////////////
|
|
25
|
-
// FONTS (DEPRECATED. DO NOT USE. PREFER CSS VARIABLES)
|
|
26
|
-
//////////////////////////////
|
|
27
|
-
|
|
28
|
-
$font-body: 'Suisse Intl' !default;
|
|
29
|
-
$font-mono: monospace !default;
|
|
30
|
-
|
|
31
24
|
//////////////////////////////
|
|
32
25
|
// COLORS (DEPRECATED. DO NOT USE. PREFER CSS VARIABLES)
|
|
33
26
|
//////////////////////////////
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDataAndFile.d.ts","sourceRoot":"","sources":["../../src/utilities/getDataAndFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAItF,KAAK,cAAc,GAAG,CAAC,IAAI,EAAE;IAC3B,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAK,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACzB,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAA;CACnC,CAAC,CAAA;AACF,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"getDataAndFile.d.ts","sourceRoot":"","sources":["../../src/utilities/getDataAndFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAItF,KAAK,cAAc,GAAG,CAAC,IAAI,EAAE;IAC3B,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAK,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACzB,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAA;CACnC,CAAC,CAAA;AACF,eAAO,MAAM,cAAc,EAAE,cAuE5B,CAAA"}
|
|
@@ -9,7 +9,11 @@ export const getDataAndFile = async ({ collection, config, request })=>{
|
|
|
9
9
|
].includes(request.method.toUpperCase()) && request.body) {
|
|
10
10
|
const [contentType] = (request.headers.get('Content-Type') || '').split(';');
|
|
11
11
|
if (contentType === 'application/json') {
|
|
12
|
-
|
|
12
|
+
try {
|
|
13
|
+
data = await request.json();
|
|
14
|
+
} catch (error) {
|
|
15
|
+
data = {};
|
|
16
|
+
}
|
|
13
17
|
} else if (contentType === 'multipart/form-data') {
|
|
14
18
|
// possible upload request
|
|
15
19
|
if (collection?.config?.upload) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/getDataAndFile.ts"],"sourcesContent":["import type { Collection, CustomPayloadRequest, SanitizedConfig } from 'payload/types'\n\nimport { nextFileUpload } from '../next-fileupload/index.js'\n\ntype GetDataAndFile = (args: {\n collection: Collection\n config: SanitizedConfig\n request: Request\n}) => Promise<{\n data: Record<string, any>\n file: CustomPayloadRequest['file']\n}>\nexport const getDataAndFile: GetDataAndFile = async ({ collection, config, request }) => {\n let data: Record<string, any> = undefined\n let file: CustomPayloadRequest['file'] = undefined\n\n if (['PATCH', 'POST', 'PUT'].includes(request.method.toUpperCase()) && request.body) {\n const [contentType] = (request.headers.get('Content-Type') || '').split(';')\n\n if (contentType === 'application/json') {\n data = await request.json()\n } else if (contentType === 'multipart/form-data') {\n // possible upload request\n if (collection?.config?.upload) {\n // load file in memory\n if (!config.upload?.useTempFiles) {\n const formData = await request.formData()\n const formFile = formData.get('file')\n\n if (formFile instanceof Blob) {\n const bytes = await formFile.arrayBuffer()\n const buffer = Buffer.from(bytes)\n\n file = {\n name: formFile.name,\n data: buffer,\n mimetype: formFile.type,\n size: formFile.size,\n }\n }\n\n const payloadData = formData.get('_payload')\n\n if (typeof payloadData === 'string') {\n data = JSON.parse(payloadData)\n }\n } else {\n // store temp file on disk\n const { error, fields, files } = await nextFileUpload({\n options: config.upload as any,\n request,\n })\n\n if (error) {\n throw new Error(error.message)\n }\n\n if (files?.file) file = files.file\n\n if (fields?._payload && typeof fields._payload === 'string') {\n data = JSON.parse(fields._payload)\n }\n }\n } else {\n // non upload request\n const formData = await request.formData()\n const payloadData = formData.get('_payload')\n\n if (typeof payloadData === 'string') {\n data = JSON.parse(payloadData)\n }\n }\n }\n }\n\n return {\n data,\n file,\n }\n}\n"],"names":["nextFileUpload","getDataAndFile","collection","config","request","data","undefined","file","includes","method","toUpperCase","body","contentType","headers","get","split","json","upload","useTempFiles","formData","formFile","Blob","bytes","arrayBuffer","buffer","Buffer","from","name","mimetype","type","size","payloadData","JSON","parse","
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/getDataAndFile.ts"],"sourcesContent":["import type { Collection, CustomPayloadRequest, SanitizedConfig } from 'payload/types'\n\nimport { nextFileUpload } from '../next-fileupload/index.js'\n\ntype GetDataAndFile = (args: {\n collection: Collection\n config: SanitizedConfig\n request: Request\n}) => Promise<{\n data: Record<string, any>\n file: CustomPayloadRequest['file']\n}>\nexport const getDataAndFile: GetDataAndFile = async ({ collection, config, request }) => {\n let data: Record<string, any> = undefined\n let file: CustomPayloadRequest['file'] = undefined\n\n if (['PATCH', 'POST', 'PUT'].includes(request.method.toUpperCase()) && request.body) {\n const [contentType] = (request.headers.get('Content-Type') || '').split(';')\n\n if (contentType === 'application/json') {\n try {\n data = await request.json()\n } catch (error) {\n data = {}\n }\n } else if (contentType === 'multipart/form-data') {\n // possible upload request\n if (collection?.config?.upload) {\n // load file in memory\n if (!config.upload?.useTempFiles) {\n const formData = await request.formData()\n const formFile = formData.get('file')\n\n if (formFile instanceof Blob) {\n const bytes = await formFile.arrayBuffer()\n const buffer = Buffer.from(bytes)\n\n file = {\n name: formFile.name,\n data: buffer,\n mimetype: formFile.type,\n size: formFile.size,\n }\n }\n\n const payloadData = formData.get('_payload')\n\n if (typeof payloadData === 'string') {\n data = JSON.parse(payloadData)\n }\n } else {\n // store temp file on disk\n const { error, fields, files } = await nextFileUpload({\n options: config.upload as any,\n request,\n })\n\n if (error) {\n throw new Error(error.message)\n }\n\n if (files?.file) file = files.file\n\n if (fields?._payload && typeof fields._payload === 'string') {\n data = JSON.parse(fields._payload)\n }\n }\n } else {\n // non upload request\n const formData = await request.formData()\n const payloadData = formData.get('_payload')\n\n if (typeof payloadData === 'string') {\n data = JSON.parse(payloadData)\n }\n }\n }\n }\n\n return {\n data,\n file,\n }\n}\n"],"names":["nextFileUpload","getDataAndFile","collection","config","request","data","undefined","file","includes","method","toUpperCase","body","contentType","headers","get","split","json","error","upload","useTempFiles","formData","formFile","Blob","bytes","arrayBuffer","buffer","Buffer","from","name","mimetype","type","size","payloadData","JSON","parse","fields","files","options","Error","message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BAC1B,MAAM,EAAEf,KAAK,EAAEkB,MAAM,EAAEC,KAAK,EAAE,GAAG,MAAMpC,eAAe;wBACpDqC,SAASlC,OAAOe,MAAM;wBACtBd;oBACF;oBAEA,IAAIa,OAAO;wBACT,MAAM,IAAIqB,MAAMrB,MAAMsB,OAAO;oBAC/B;oBAEA,IAAIH,OAAO7B,MAAMA,OAAO6B,MAAM7B,IAAI;oBAElC,IAAI4B,QAAQK,YAAY,OAAOL,OAAOK,QAAQ,KAAK,UAAU;wBAC3DnC,OAAO4B,KAAKC,KAAK,CAACC,OAAOK,QAAQ;oBACnC;gBACF;YACF,OAAO;gBACL,qBAAqB;gBACrB,MAAMpB,WAAW,MAAMhB,QAAQgB,QAAQ;gBACvC,MAAMY,cAAcZ,SAASN,GAAG,CAAC;gBAEjC,IAAI,OAAOkB,gBAAgB,UAAU;oBACnC3B,OAAO4B,KAAKC,KAAK,CAACF;gBACpB;YACF;QACF;IACF;IAEA,OAAO;QACL3B;QACAE;IACF;AACF,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/next",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.9",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"terser-webpack-plugin": "^5.3.10",
|
|
43
43
|
"webpack": "^5.78.0",
|
|
44
44
|
"webpack-cli": "^5.1.4",
|
|
45
|
-
"payload": "3.0.0-beta.
|
|
45
|
+
"payload": "3.0.0-beta.9",
|
|
46
46
|
"@payloadcms/eslint-config": "1.1.1"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
"react-toastify": "8.2.0",
|
|
60
60
|
"sass": "^1.71.1",
|
|
61
61
|
"ws": "^8.16.0",
|
|
62
|
-
"@payloadcms/translations": "3.0.0-beta.
|
|
63
|
-
"@payloadcms/
|
|
64
|
-
"@payloadcms/
|
|
62
|
+
"@payloadcms/translations": "3.0.0-beta.9",
|
|
63
|
+
"@payloadcms/graphql": "3.0.0-beta.9",
|
|
64
|
+
"@payloadcms/ui": "3.0.0-beta.9"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"http-status": "1.6.2",
|
|
68
|
-
"next": "14.2
|
|
69
|
-
"payload": "3.0.0-beta.
|
|
68
|
+
"next": "^14.2",
|
|
69
|
+
"payload": "3.0.0-beta.9"
|
|
70
70
|
},
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"registry": "https://registry.npmjs.org/"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/scss/fonts.scss
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
@font-face {
|
|
2
|
-
font-family: 'Suisse Intl';
|
|
3
|
-
src:
|
|
4
|
-
url('../assets/fonts/SuisseIntl.woff2') format('woff2'),
|
|
5
|
-
url('../assets/fonts/SuisseIntl.woff') format('woff');
|
|
6
|
-
font-weight: normal;
|
|
7
|
-
font-style: normal;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@font-face {
|
|
11
|
-
font-family: 'Suisse Intl';
|
|
12
|
-
src:
|
|
13
|
-
url('../assets/fonts/SuisseIntl-Medium.woff2') format('woff2'),
|
|
14
|
-
url('../assets/fonts/SuisseIntl-Medium.woff') format('woff');
|
|
15
|
-
font-weight: 500;
|
|
16
|
-
font-style: normal;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@font-face {
|
|
20
|
-
font-family: 'Suisse Intl';
|
|
21
|
-
src:
|
|
22
|
-
url('../assets/fonts/SuisseIntl-SemiBold.woff2') format('woff2'),
|
|
23
|
-
url('../assets/fonts/SuisseIntl-SemiBold.woff') format('woff');
|
|
24
|
-
font-weight: 600;
|
|
25
|
-
font-style: normal;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@font-face {
|
|
29
|
-
font-family: 'Suisse Intl';
|
|
30
|
-
src:
|
|
31
|
-
url('../assets/fonts/SuisseIntl-Bold.woff2') format('woff2'),
|
|
32
|
-
url('../assets/fonts/SuisseIntl-Bold.woff') format('woff');
|
|
33
|
-
font-weight: bold;
|
|
34
|
-
font-style: normal;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@font-face {
|
|
38
|
-
font-family: 'Merriweather';
|
|
39
|
-
font-style: normal;
|
|
40
|
-
font-weight: 400;
|
|
41
|
-
src:
|
|
42
|
-
local(''),
|
|
43
|
-
url('../assets/fonts/merriweather-v30-latin-regular.woff2') format('woff2'),
|
|
44
|
-
url('../assets/fonts/merriweather-v30-latin-regular.woff') format('woff');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@font-face {
|
|
48
|
-
font-family: 'Merriweather';
|
|
49
|
-
font-style: italic;
|
|
50
|
-
font-weight: 400;
|
|
51
|
-
src:
|
|
52
|
-
local(''),
|
|
53
|
-
url('../assets/fonts/merriweather-v30-latin-italic.woff2') format('woff2'),
|
|
54
|
-
url('../assets/fonts/merriweather-v30-latin-italic.woff') format('woff');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@font-face {
|
|
58
|
-
font-family: 'Merriweather';
|
|
59
|
-
font-style: normal;
|
|
60
|
-
font-weight: 900;
|
|
61
|
-
src:
|
|
62
|
-
local(''),
|
|
63
|
-
url('../assets/fonts/merriweather-v30-latin-900.woff2') format('woff2'),
|
|
64
|
-
url('../assets/fonts/merriweather-v30-latin-900.woff') format('woff');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@font-face {
|
|
68
|
-
font-family: 'Merriweather';
|
|
69
|
-
font-style: italic;
|
|
70
|
-
font-weight: 900;
|
|
71
|
-
src:
|
|
72
|
-
local(''),
|
|
73
|
-
url('../assets/fonts/merriweather-v30-latin-900italic.woff2') format('woff2'),
|
|
74
|
-
url('../assets/fonts/merriweather-v30-latin-900italic.woff') format('woff');
|
|
75
|
-
}
|