dn-react-router-toolkit 0.5.0 → 0.5.1

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.
@@ -8,6 +8,6 @@ declare const createAPIHandler: <TFile>({ authService, fileService, passwordReco
8
8
  passwordRecoveryService: PasswordRecoveryService;
9
9
  getThirdPartyAuth: (provider: string) => ThirdpartyAuth;
10
10
  signupTokenManager: JWTManager<ThirdpartySignupTokenPayload>;
11
- }) => (args: LoaderFunctionArgs | ActionFunctionArgs) => Promise<Response | (({ request }: ActionFunctionArgs<any> | LoaderFunctionArgs<any>) => Promise<Response>)>;
11
+ }) => (args: LoaderFunctionArgs | ActionFunctionArgs) => Promise<(({ request }: LoaderFunctionArgs<any> | ActionFunctionArgs<any>) => Promise<Response>) | Response>;
12
12
 
13
13
  export { createAPIHandler };
@@ -8,6 +8,6 @@ declare const createAPIHandler: <TFile>({ authService, fileService, passwordReco
8
8
  passwordRecoveryService: PasswordRecoveryService;
9
9
  getThirdPartyAuth: (provider: string) => ThirdpartyAuth;
10
10
  signupTokenManager: JWTManager<ThirdpartySignupTokenPayload>;
11
- }) => (args: LoaderFunctionArgs | ActionFunctionArgs) => Promise<Response | (({ request }: ActionFunctionArgs<any> | LoaderFunctionArgs<any>) => Promise<Response>)>;
11
+ }) => (args: LoaderFunctionArgs | ActionFunctionArgs) => Promise<(({ request }: LoaderFunctionArgs<any> | ActionFunctionArgs<any>) => Promise<Response>) | Response>;
12
12
 
13
13
  export { createAPIHandler };
package/dist/seo/index.js CHANGED
@@ -98,7 +98,10 @@ function configSEO(config) {
98
98
  content: socialImage.length > 0 ? "summary_large_image" : "summary"
99
99
  },
100
100
  pageTitle && { property: "twitter:title", content: pageTitle },
101
- description && { property: "twitter:description", content: description },
101
+ description && {
102
+ property: "twitter:description",
103
+ content: description
104
+ },
102
105
  ...socialImage?.map((file) => ({
103
106
  property: "twitter:image",
104
107
  content: file.url
@@ -106,16 +109,10 @@ function configSEO(config) {
106
109
  ];
107
110
  };
108
111
  function StructedData() {
109
- const matches = (0, import_react_router.useMatches)();
110
- const data = matches.reduce((acc, match) => {
111
- return {
112
- ...acc,
113
- ...match.loaderData?.seo || {}
114
- };
115
- }, {});
116
- const { pageTitle, description, keywords, url, thumbnail } = data;
112
+ const { seo } = (0, import_react_router.useLoaderData)();
113
+ const props = seo || {};
114
+ const { pageTitle, description, keywords, url, thumbnail } = props;
117
115
  const thumbnailUrl = thumbnail?.url;
118
- const props = data?.seo || {};
119
116
  const websiteSchemaId = `${config.origin}/#website`;
120
117
  const websiteSchema = {
121
118
  "@type": "WebSite",
@@ -136,7 +133,9 @@ function configSEO(config) {
136
133
  }
137
134
  ] : [],
138
135
  ...props.images || [],
139
- ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
136
+ ...props.collection?.map(
137
+ (portfolio) => portfolio.thumbnail
138
+ ) || []
140
139
  ].filter(Boolean);
141
140
  const image = images.filter((file) => file.id).map((file) => ({
142
141
  "@type": "ImageObject",
@@ -152,21 +151,23 @@ function configSEO(config) {
152
151
  const collectionMainEntity = props.collection ? {
153
152
  "@type": "ItemList",
154
153
  numberOfItems: props.collection.length,
155
- itemListElement: props.collection.map((item, index) => ({
156
- "@type": "ListItem",
157
- position: index + 1,
158
- url: item.url,
159
- item: {
160
- "@type": "WebPage",
161
- "@id": `${item.url}#webpage`,
154
+ itemListElement: props.collection.map(
155
+ (item, index) => ({
156
+ "@type": "ListItem",
157
+ position: index + 1,
162
158
  url: item.url,
163
- name: item.title,
164
- thumbnailUrl: item.thumbnail?.url,
165
- dateModified: item.updatedAt?.toISOString(),
166
- dateCreated: item.createdAt?.toISOString(),
167
- datePublished: item.createdAt?.toISOString()
168
- }
169
- }))
159
+ item: {
160
+ "@type": "WebPage",
161
+ "@id": `${item.url}#webpage`,
162
+ url: item.url,
163
+ name: item.title,
164
+ thumbnailUrl: item.thumbnail?.url,
165
+ dateModified: item.updatedAt?.toISOString(),
166
+ dateCreated: item.createdAt?.toISOString(),
167
+ datePublished: item.createdAt?.toISOString()
168
+ }
169
+ })
170
+ )
170
171
  } : void 0;
171
172
  const structuredData = {
172
173
  "@context": "https://schema.org",
@@ -35,7 +35,7 @@ var require_schema = __commonJS({
35
35
  // src/seo/seo.tsx
36
36
  var Schema = __toESM(require_schema());
37
37
  import React from "react";
38
- import { useMatches } from "react-router";
38
+ import { useLoaderData } from "react-router";
39
39
  function configSEO(config) {
40
40
  function init(props) {
41
41
  const canonicalPath = props.canonicalPath;
@@ -85,7 +85,10 @@ function configSEO(config) {
85
85
  content: socialImage.length > 0 ? "summary_large_image" : "summary"
86
86
  },
87
87
  pageTitle && { property: "twitter:title", content: pageTitle },
88
- description && { property: "twitter:description", content: description },
88
+ description && {
89
+ property: "twitter:description",
90
+ content: description
91
+ },
89
92
  ...socialImage?.map((file) => ({
90
93
  property: "twitter:image",
91
94
  content: file.url
@@ -93,16 +96,10 @@ function configSEO(config) {
93
96
  ];
94
97
  };
95
98
  function StructedData() {
96
- const matches = useMatches();
97
- const data = matches.reduce((acc, match) => {
98
- return {
99
- ...acc,
100
- ...match.loaderData?.seo || {}
101
- };
102
- }, {});
103
- const { pageTitle, description, keywords, url, thumbnail } = data;
99
+ const { seo } = useLoaderData();
100
+ const props = seo || {};
101
+ const { pageTitle, description, keywords, url, thumbnail } = props;
104
102
  const thumbnailUrl = thumbnail?.url;
105
- const props = data?.seo || {};
106
103
  const websiteSchemaId = `${config.origin}/#website`;
107
104
  const websiteSchema = {
108
105
  "@type": "WebSite",
@@ -123,7 +120,9 @@ function configSEO(config) {
123
120
  }
124
121
  ] : [],
125
122
  ...props.images || [],
126
- ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
123
+ ...props.collection?.map(
124
+ (portfolio) => portfolio.thumbnail
125
+ ) || []
127
126
  ].filter(Boolean);
128
127
  const image = images.filter((file) => file.id).map((file) => ({
129
128
  "@type": "ImageObject",
@@ -139,21 +138,23 @@ function configSEO(config) {
139
138
  const collectionMainEntity = props.collection ? {
140
139
  "@type": "ItemList",
141
140
  numberOfItems: props.collection.length,
142
- itemListElement: props.collection.map((item, index) => ({
143
- "@type": "ListItem",
144
- position: index + 1,
145
- url: item.url,
146
- item: {
147
- "@type": "WebPage",
148
- "@id": `${item.url}#webpage`,
141
+ itemListElement: props.collection.map(
142
+ (item, index) => ({
143
+ "@type": "ListItem",
144
+ position: index + 1,
149
145
  url: item.url,
150
- name: item.title,
151
- thumbnailUrl: item.thumbnail?.url,
152
- dateModified: item.updatedAt?.toISOString(),
153
- dateCreated: item.createdAt?.toISOString(),
154
- datePublished: item.createdAt?.toISOString()
155
- }
156
- }))
146
+ item: {
147
+ "@type": "WebPage",
148
+ "@id": `${item.url}#webpage`,
149
+ url: item.url,
150
+ name: item.title,
151
+ thumbnailUrl: item.thumbnail?.url,
152
+ dateModified: item.updatedAt?.toISOString(),
153
+ dateCreated: item.createdAt?.toISOString(),
154
+ datePublished: item.createdAt?.toISOString()
155
+ }
156
+ })
157
+ )
157
158
  } : void 0;
158
159
  const structuredData = {
159
160
  "@context": "https://schema.org",
package/dist/seo/seo.js CHANGED
@@ -96,7 +96,10 @@ function configSEO(config) {
96
96
  content: socialImage.length > 0 ? "summary_large_image" : "summary"
97
97
  },
98
98
  pageTitle && { property: "twitter:title", content: pageTitle },
99
- description && { property: "twitter:description", content: description },
99
+ description && {
100
+ property: "twitter:description",
101
+ content: description
102
+ },
100
103
  ...socialImage?.map((file) => ({
101
104
  property: "twitter:image",
102
105
  content: file.url
@@ -104,16 +107,10 @@ function configSEO(config) {
104
107
  ];
105
108
  };
106
109
  function StructedData() {
107
- const matches = (0, import_react_router.useMatches)();
108
- const data = matches.reduce((acc, match) => {
109
- return {
110
- ...acc,
111
- ...match.loaderData?.seo || {}
112
- };
113
- }, {});
114
- const { pageTitle, description, keywords, url, thumbnail } = data;
110
+ const { seo } = (0, import_react_router.useLoaderData)();
111
+ const props = seo || {};
112
+ const { pageTitle, description, keywords, url, thumbnail } = props;
115
113
  const thumbnailUrl = thumbnail?.url;
116
- const props = data?.seo || {};
117
114
  const websiteSchemaId = `${config.origin}/#website`;
118
115
  const websiteSchema = {
119
116
  "@type": "WebSite",
@@ -134,7 +131,9 @@ function configSEO(config) {
134
131
  }
135
132
  ] : [],
136
133
  ...props.images || [],
137
- ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
134
+ ...props.collection?.map(
135
+ (portfolio) => portfolio.thumbnail
136
+ ) || []
138
137
  ].filter(Boolean);
139
138
  const image = images.filter((file) => file.id).map((file) => ({
140
139
  "@type": "ImageObject",
@@ -150,21 +149,23 @@ function configSEO(config) {
150
149
  const collectionMainEntity = props.collection ? {
151
150
  "@type": "ItemList",
152
151
  numberOfItems: props.collection.length,
153
- itemListElement: props.collection.map((item, index) => ({
154
- "@type": "ListItem",
155
- position: index + 1,
156
- url: item.url,
157
- item: {
158
- "@type": "WebPage",
159
- "@id": `${item.url}#webpage`,
152
+ itemListElement: props.collection.map(
153
+ (item, index) => ({
154
+ "@type": "ListItem",
155
+ position: index + 1,
160
156
  url: item.url,
161
- name: item.title,
162
- thumbnailUrl: item.thumbnail?.url,
163
- dateModified: item.updatedAt?.toISOString(),
164
- dateCreated: item.createdAt?.toISOString(),
165
- datePublished: item.createdAt?.toISOString()
166
- }
167
- }))
157
+ item: {
158
+ "@type": "WebPage",
159
+ "@id": `${item.url}#webpage`,
160
+ url: item.url,
161
+ name: item.title,
162
+ thumbnailUrl: item.thumbnail?.url,
163
+ dateModified: item.updatedAt?.toISOString(),
164
+ dateCreated: item.createdAt?.toISOString(),
165
+ datePublished: item.createdAt?.toISOString()
166
+ }
167
+ })
168
+ )
168
169
  } : void 0;
169
170
  const structuredData = {
170
171
  "@context": "https://schema.org",
package/dist/seo/seo.mjs CHANGED
@@ -35,7 +35,7 @@ var require_schema = __commonJS({
35
35
  // src/seo/seo.tsx
36
36
  var Schema = __toESM(require_schema());
37
37
  import React from "react";
38
- import { useMatches } from "react-router";
38
+ import { useLoaderData } from "react-router";
39
39
  function configSEO(config) {
40
40
  function init(props) {
41
41
  const canonicalPath = props.canonicalPath;
@@ -85,7 +85,10 @@ function configSEO(config) {
85
85
  content: socialImage.length > 0 ? "summary_large_image" : "summary"
86
86
  },
87
87
  pageTitle && { property: "twitter:title", content: pageTitle },
88
- description && { property: "twitter:description", content: description },
88
+ description && {
89
+ property: "twitter:description",
90
+ content: description
91
+ },
89
92
  ...socialImage?.map((file) => ({
90
93
  property: "twitter:image",
91
94
  content: file.url
@@ -93,16 +96,10 @@ function configSEO(config) {
93
96
  ];
94
97
  };
95
98
  function StructedData() {
96
- const matches = useMatches();
97
- const data = matches.reduce((acc, match) => {
98
- return {
99
- ...acc,
100
- ...match.loaderData?.seo || {}
101
- };
102
- }, {});
103
- const { pageTitle, description, keywords, url, thumbnail } = data;
99
+ const { seo } = useLoaderData();
100
+ const props = seo || {};
101
+ const { pageTitle, description, keywords, url, thumbnail } = props;
104
102
  const thumbnailUrl = thumbnail?.url;
105
- const props = data?.seo || {};
106
103
  const websiteSchemaId = `${config.origin}/#website`;
107
104
  const websiteSchema = {
108
105
  "@type": "WebSite",
@@ -123,7 +120,9 @@ function configSEO(config) {
123
120
  }
124
121
  ] : [],
125
122
  ...props.images || [],
126
- ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
123
+ ...props.collection?.map(
124
+ (portfolio) => portfolio.thumbnail
125
+ ) || []
127
126
  ].filter(Boolean);
128
127
  const image = images.filter((file) => file.id).map((file) => ({
129
128
  "@type": "ImageObject",
@@ -139,21 +138,23 @@ function configSEO(config) {
139
138
  const collectionMainEntity = props.collection ? {
140
139
  "@type": "ItemList",
141
140
  numberOfItems: props.collection.length,
142
- itemListElement: props.collection.map((item, index) => ({
143
- "@type": "ListItem",
144
- position: index + 1,
145
- url: item.url,
146
- item: {
147
- "@type": "WebPage",
148
- "@id": `${item.url}#webpage`,
141
+ itemListElement: props.collection.map(
142
+ (item, index) => ({
143
+ "@type": "ListItem",
144
+ position: index + 1,
149
145
  url: item.url,
150
- name: item.title,
151
- thumbnailUrl: item.thumbnail?.url,
152
- dateModified: item.updatedAt?.toISOString(),
153
- dateCreated: item.createdAt?.toISOString(),
154
- datePublished: item.createdAt?.toISOString()
155
- }
156
- }))
146
+ item: {
147
+ "@type": "WebPage",
148
+ "@id": `${item.url}#webpage`,
149
+ url: item.url,
150
+ name: item.title,
151
+ thumbnailUrl: item.thumbnail?.url,
152
+ dateModified: item.updatedAt?.toISOString(),
153
+ dateCreated: item.createdAt?.toISOString(),
154
+ datePublished: item.createdAt?.toISOString()
155
+ }
156
+ })
157
+ )
157
158
  } : void 0;
158
159
  const structuredData = {
159
160
  "@context": "https://schema.org",
@@ -20,7 +20,7 @@ declare function tableLoader<T extends Table, TSelect>({ repository, tableOption
20
20
  limit: number;
21
21
  offset: number;
22
22
  orderBy: keyof T["_"]["columns"] & string;
23
- direction: "asc" | "desc";
23
+ direction: "desc" | "asc";
24
24
  searchKey: ColumnOf<T> | undefined;
25
25
  };
26
26
  }>;
@@ -20,7 +20,7 @@ declare function tableLoader<T extends Table, TSelect>({ repository, tableOption
20
20
  limit: number;
21
21
  offset: number;
22
22
  orderBy: keyof T["_"]["columns"] & string;
23
- direction: "asc" | "desc";
23
+ direction: "desc" | "asc";
24
24
  searchKey: ColumnOf<T> | undefined;
25
25
  };
26
26
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dn-react-router-toolkit",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.js",
@@ -71,7 +71,7 @@
71
71
  },
72
72
  "dependencies": {
73
73
  "@react-router/dev": "^7.11.0",
74
- "dn-react-toolkit": "0.2.29",
74
+ "dn-react-toolkit": "0.2.30",
75
75
  "pg": "^8.16.3",
76
76
  "uuid": "^13.0.0"
77
77
  },