@sitecore-content-sdk/nextjs 2.0.2 → 2.1.0-canary.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.
- package/LICENSE.txt +202 -202
- package/dist/cjs/components/Link.js +6 -1
- package/dist/cjs/proxy/bot-tracking-proxy.js +116 -0
- package/dist/cjs/proxy/index.js +3 -1
- package/dist/cjs/proxy/personalize-proxy.js +10 -3
- package/dist/cjs/proxy/proxy.js +32 -2
- package/dist/esm/components/Link.js +6 -1
- package/dist/esm/proxy/bot-tracking-proxy.js +109 -0
- package/dist/esm/proxy/index.js +1 -0
- package/dist/esm/proxy/personalize-proxy.js +10 -3
- package/dist/esm/proxy/proxy.js +32 -2
- package/package.json +13 -12
- package/types/components/Link.d.ts.map +1 -1
- package/types/proxy/bot-tracking-proxy.d.ts +33 -0
- package/types/proxy/bot-tracking-proxy.d.ts.map +1 -0
- package/types/proxy/index.d.ts +1 -0
- package/types/proxy/index.d.ts.map +1 -1
- package/types/proxy/personalize-proxy.d.ts +5 -0
- package/types/proxy/personalize-proxy.d.ts.map +1 -1
- package/types/proxy/proxy.d.ts +1 -1
- package/types/proxy/proxy.d.ts.map +1 -1
package/LICENSE.txt
CHANGED
|
@@ -1,202 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
Apache License
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
http://www.apache.org/licenses/
|
|
5
|
-
|
|
6
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
-
|
|
8
|
-
1. Definitions.
|
|
9
|
-
|
|
10
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
-
|
|
13
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
-
the copyright owner that is granting the License.
|
|
15
|
-
|
|
16
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
-
other entities that control, are controlled by, or are under common
|
|
18
|
-
control with that entity. For the purposes of this definition,
|
|
19
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
-
direction or management of such entity, whether by contract or
|
|
21
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
-
|
|
24
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
-
exercising permissions granted by this License.
|
|
26
|
-
|
|
27
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
-
including but not limited to software source code, documentation
|
|
29
|
-
source, and configuration files.
|
|
30
|
-
|
|
31
|
-
"Object" form shall mean any form resulting from mechanical
|
|
32
|
-
transformation or translation of a Source form, including but
|
|
33
|
-
not limited to compiled object code, generated documentation,
|
|
34
|
-
and conversions to other media types.
|
|
35
|
-
|
|
36
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
-
Object form, made available under the License, as indicated by a
|
|
38
|
-
copyright notice that is included in or attached to the work
|
|
39
|
-
(an example is provided in the Appendix below).
|
|
40
|
-
|
|
41
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
-
form, that is based on (or derived from) the Work and for which the
|
|
43
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
-
of this License, Derivative Works shall not include works that remain
|
|
46
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
-
the Work and Derivative Works thereof.
|
|
48
|
-
|
|
49
|
-
"Contribution" shall mean any work of authorship, including
|
|
50
|
-
the original version of the Work and any modifications or additions
|
|
51
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
-
means any form of electronic, verbal, or written communication sent
|
|
56
|
-
to the Licensor or its representatives, including but not limited to
|
|
57
|
-
communication on electronic mailing lists, source code control systems,
|
|
58
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
-
excluding communication that is conspicuously marked or otherwise
|
|
61
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
-
|
|
63
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
-
subsequently incorporated within the Work.
|
|
66
|
-
|
|
67
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
-
Work and such Derivative Works in Source or Object form.
|
|
73
|
-
|
|
74
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
-
(except as stated in this section) patent license to make, have made,
|
|
78
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
-
where such license applies only to those patent claims licensable
|
|
80
|
-
by such Contributor that are necessarily infringed by their
|
|
81
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
-
institute patent litigation against any entity (including a
|
|
84
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
-
or contributory patent infringement, then any patent licenses
|
|
87
|
-
granted to You under this License for that Work shall terminate
|
|
88
|
-
as of the date such litigation is filed.
|
|
89
|
-
|
|
90
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
-
modifications, and in Source or Object form, provided that You
|
|
93
|
-
meet the following conditions:
|
|
94
|
-
|
|
95
|
-
(a) You must give any other recipients of the Work or
|
|
96
|
-
Derivative Works a copy of this License; and
|
|
97
|
-
|
|
98
|
-
(b) You must cause any modified files to carry prominent notices
|
|
99
|
-
stating that You changed the files; and
|
|
100
|
-
|
|
101
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
-
that You distribute, all copyright, patent, trademark, and
|
|
103
|
-
attribution notices from the Source form of the Work,
|
|
104
|
-
excluding those notices that do not pertain to any part of
|
|
105
|
-
the Derivative Works; and
|
|
106
|
-
|
|
107
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
-
distribution, then any Derivative Works that You distribute must
|
|
109
|
-
include a readable copy of the attribution notices contained
|
|
110
|
-
within such NOTICE file, excluding those notices that do not
|
|
111
|
-
pertain to any part of the Derivative Works, in at least one
|
|
112
|
-
of the following places: within a NOTICE text file distributed
|
|
113
|
-
as part of the Derivative Works; within the Source form or
|
|
114
|
-
documentation, if provided along with the Derivative Works; or,
|
|
115
|
-
within a display generated by the Derivative Works, if and
|
|
116
|
-
wherever such third-party notices normally appear. The contents
|
|
117
|
-
of the NOTICE file are for informational purposes only and
|
|
118
|
-
do not modify the License. You may add Your own attribution
|
|
119
|
-
notices within Derivative Works that You distribute, alongside
|
|
120
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
-
that such additional attribution notices cannot be construed
|
|
122
|
-
as modifying the License.
|
|
123
|
-
|
|
124
|
-
You may add Your own copyright statement to Your modifications and
|
|
125
|
-
may provide additional or different license terms and conditions
|
|
126
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
-
the conditions stated in this License.
|
|
130
|
-
|
|
131
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
-
this License, without any additional terms or conditions.
|
|
135
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
-
the terms of any separate license agreement you may have executed
|
|
137
|
-
with Licensor regarding such Contributions.
|
|
138
|
-
|
|
139
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
-
except as required for reasonable and customary use in describing the
|
|
142
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
-
|
|
144
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
-
implied, including, without limitation, any warranties or conditions
|
|
149
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
-
appropriateness of using or redistributing the Work and assume any
|
|
152
|
-
risks associated with Your exercise of permissions under this License.
|
|
153
|
-
|
|
154
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
-
unless required by applicable law (such as deliberate and grossly
|
|
157
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
-
liable to You for damages, including any direct, indirect, special,
|
|
159
|
-
incidental, or consequential damages of any character arising as a
|
|
160
|
-
result of this License or out of the use or inability to use the
|
|
161
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
-
other commercial damages or losses), even if such Contributor
|
|
164
|
-
has been advised of the possibility of such damages.
|
|
165
|
-
|
|
166
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
-
or other liability obligations and/or rights consistent with this
|
|
170
|
-
License. However, in accepting such obligations, You may act only
|
|
171
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
-
defend, and hold each Contributor harmless for any liability
|
|
174
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
-
of your accepting any such warranty or additional liability.
|
|
176
|
-
|
|
177
|
-
END OF TERMS AND CONDITIONS
|
|
178
|
-
|
|
179
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
-
|
|
181
|
-
To apply the Apache License to your work, attach the following
|
|
182
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
-
replaced with your own identifying information. (Don't include
|
|
184
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
-
comment syntax for the file format. We also recommend that a
|
|
186
|
-
file or class name and description of purpose be included on the
|
|
187
|
-
same "printed page" as the copyright notice for easier
|
|
188
|
-
identification within third-party archives.
|
|
189
|
-
|
|
190
|
-
Copyright [yyyy] [name of copyright owner]
|
|
191
|
-
|
|
192
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
-
you may not use this file except in compliance with the License.
|
|
194
|
-
You may obtain a copy of the License at
|
|
195
|
-
|
|
196
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
-
|
|
198
|
-
Unless required by applicable law or agreed to in writing, software
|
|
199
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
-
See the License for the specific language governing permissions and
|
|
202
|
-
limitations under the License.
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -52,6 +52,7 @@ exports.Link = void 0;
|
|
|
52
52
|
const react_1 = __importStar(require("react"));
|
|
53
53
|
const link_1 = __importDefault(require("next/link"));
|
|
54
54
|
const react_2 = require("@sitecore-content-sdk/react");
|
|
55
|
+
const router_1 = require("next/compat/router");
|
|
55
56
|
/**
|
|
56
57
|
* The list of NextLink props to be supported by the Link component.
|
|
57
58
|
*/
|
|
@@ -73,6 +74,7 @@ const FILE_EXTENSION_MATCHER = /^\/.*\.\w+$/;
|
|
|
73
74
|
* @public
|
|
74
75
|
*/
|
|
75
76
|
exports.Link = (0, react_1.forwardRef)((props, ref) => {
|
|
77
|
+
const pageRouter = (0, router_1.useRouter)();
|
|
76
78
|
const { field, editable = true, children, internalLinkMatcher = /^\//g, showLinkTextWithChildrenPresent } = props, rest = __rest(props, ["field", "editable", "children", "internalLinkMatcher", "showLinkTextWithChildrenPresent"]);
|
|
77
79
|
if (!field || (!field.value && !field.href && !field.metadata)) {
|
|
78
80
|
return null;
|
|
@@ -87,10 +89,13 @@ exports.Link = (0, react_1.forwardRef)((props, ref) => {
|
|
|
87
89
|
const isFileUrl = FILE_EXTENSION_MATCHER.test(href);
|
|
88
90
|
// determine if a link is a route or not. File extensions are not routes and should not be pre-fetched.
|
|
89
91
|
if (isMatching && !isFileUrl) {
|
|
90
|
-
return (react_1.default.createElement(link_1.default, Object.assign({ href: { pathname: href, query: querystring, hash: anchor }, key: "link", title: value.title, target: value.target, className: value.class }, rest, {
|
|
92
|
+
return (react_1.default.createElement(link_1.default, Object.assign({ href: { pathname: href, query: querystring, hash: anchor }, key: "link", title: value.title, target: value.target, className: value.class }, rest, {
|
|
93
|
+
// locale prop is supported only in Pages Router
|
|
94
|
+
locale: pageRouter ? false : undefined, ref: ref }, (process.env.TEST
|
|
91
95
|
? {
|
|
92
96
|
'data-nextjs-link': true,
|
|
93
97
|
'data-nextjs-prefetch': props.prefetch,
|
|
98
|
+
'data-nextjs-locale': pageRouter ? false : undefined,
|
|
94
99
|
}
|
|
95
100
|
: {})),
|
|
96
101
|
text,
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BotTrackingProxy = void 0;
|
|
7
|
+
const core_1 = require("@sitecore-content-sdk/core");
|
|
8
|
+
const analytics_core_1 = require("@sitecore-content-sdk/analytics-core");
|
|
9
|
+
const events_1 = require("@sitecore-content-sdk/events");
|
|
10
|
+
const internal_1 = require("@sitecore-content-sdk/events/internal");
|
|
11
|
+
const proxy_1 = require("./proxy");
|
|
12
|
+
const debug_1 = __importDefault(require("../debug"));
|
|
13
|
+
const analytics_adapter_1 = require("../initialization/proxy/analytics-adapter");
|
|
14
|
+
/**
|
|
15
|
+
* Next.js proxy that runs bot detection once per request and sets the bot cookie.
|
|
16
|
+
* Run first in the proxy chain to ensure that the bot cookie is set before other proxies run.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
class BotTrackingProxy extends proxy_1.ProxyBase {
|
|
20
|
+
constructor(config) {
|
|
21
|
+
super(config);
|
|
22
|
+
this.config = config;
|
|
23
|
+
this.handle = async (req, res) => {
|
|
24
|
+
try {
|
|
25
|
+
const isDisabled = (this.config.skip && this.config.skip(req, res)) || false;
|
|
26
|
+
debug_1.default.common('bot tracking proxy start: %o', {
|
|
27
|
+
pathname: req.nextUrl.pathname,
|
|
28
|
+
headers: this.extractDebugHeaders(req.headers),
|
|
29
|
+
});
|
|
30
|
+
if (isDisabled) {
|
|
31
|
+
debug_1.default.common('bot tracking proxy skipped (disabled)');
|
|
32
|
+
return res;
|
|
33
|
+
}
|
|
34
|
+
if (this.isPreview(req)) {
|
|
35
|
+
debug_1.default.common('bot tracking proxy skipped (preview)');
|
|
36
|
+
return res;
|
|
37
|
+
}
|
|
38
|
+
if (this.shouldSkipForLocalEnvironment(req)) {
|
|
39
|
+
debug_1.default.common('bot tracking proxy skipped (local environment)');
|
|
40
|
+
return res;
|
|
41
|
+
}
|
|
42
|
+
if (!(0, internal_1.isBot)(req.headers.get('user-agent'))) {
|
|
43
|
+
debug_1.default.common('bot tracking proxy skipped (not a bot)');
|
|
44
|
+
return res;
|
|
45
|
+
}
|
|
46
|
+
if (this.isPrefetch(req)) {
|
|
47
|
+
debug_1.default.common('bot tracking proxy skipped (prefetch)');
|
|
48
|
+
return res;
|
|
49
|
+
}
|
|
50
|
+
const site = this.getSite(req, res);
|
|
51
|
+
const botTracking = async () => {
|
|
52
|
+
await (0, core_1.initContentSdk)({
|
|
53
|
+
config: {
|
|
54
|
+
contextId: this.config.contextId,
|
|
55
|
+
edgeUrl: this.config.edgeUrl,
|
|
56
|
+
siteName: site.name,
|
|
57
|
+
},
|
|
58
|
+
plugins: [
|
|
59
|
+
(0, analytics_core_1.analyticsPlugin)({
|
|
60
|
+
options: {
|
|
61
|
+
enableCookie: false,
|
|
62
|
+
},
|
|
63
|
+
adapter: (0, analytics_adapter_1.analyticsProxyAdapter)(req, res),
|
|
64
|
+
}),
|
|
65
|
+
(0, events_1.eventsPlugin)(),
|
|
66
|
+
],
|
|
67
|
+
});
|
|
68
|
+
await (0, events_1.botPageView)();
|
|
69
|
+
};
|
|
70
|
+
res.cookies.set(internal_1.BOT_DETECTION_COOKIE, '1', {
|
|
71
|
+
secure: true,
|
|
72
|
+
sameSite: 'lax',
|
|
73
|
+
path: '/',
|
|
74
|
+
});
|
|
75
|
+
if (this.config.fetchEvent) {
|
|
76
|
+
this.config.fetchEvent.waitUntil(botTracking());
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
await botTracking();
|
|
80
|
+
}
|
|
81
|
+
debug_1.default.common('bot tracking proxy end: %o', {
|
|
82
|
+
pathname: req.nextUrl.pathname,
|
|
83
|
+
cookies: res.cookies,
|
|
84
|
+
});
|
|
85
|
+
return res;
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
debug_1.default.common('bot tracking proxy error: %o', error);
|
|
89
|
+
return res;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* @param {NextRequest} req - Incoming request
|
|
95
|
+
* @returns True when bot tracking should be skipped for a local / dev environment.
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
98
|
+
shouldSkipForLocalEnvironment(req) {
|
|
99
|
+
// Allow bot tracking in local environment for development purposes
|
|
100
|
+
if (process.env.SITECORE_ENABLE_BOT_TRACKING === 'true') {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
if (process.env.NODE_ENV === 'development') {
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
const hostName = (this.getHostHeader(req) ||
|
|
107
|
+
req.nextUrl.hostname ||
|
|
108
|
+
this.defaultHostname ||
|
|
109
|
+
'').toLowerCase();
|
|
110
|
+
return (hostName === 'localhost' ||
|
|
111
|
+
hostName === '127.0.0.1' ||
|
|
112
|
+
hostName === '::1' ||
|
|
113
|
+
hostName === '[::1]');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.BotTrackingProxy = BotTrackingProxy;
|
package/dist/cjs/proxy/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.debug = exports.REDIRECT_TYPE_SERVER_TRANSFER = exports.REDIRECT_TYPE_302 = exports.REDIRECT_TYPE_301 = exports.RedirectsService = exports.PersonalizeService = exports.LocaleProxy = exports.AppRouterMultisiteProxy = exports.MultisiteProxy = exports.PersonalizeProxy = exports.RedirectsProxy = exports.defineProxy = exports.ProxyHandler = exports.ProxyBase = void 0;
|
|
6
|
+
exports.debug = exports.REDIRECT_TYPE_SERVER_TRANSFER = exports.REDIRECT_TYPE_302 = exports.REDIRECT_TYPE_301 = exports.RedirectsService = exports.BotTrackingProxy = exports.PersonalizeService = exports.LocaleProxy = exports.AppRouterMultisiteProxy = exports.MultisiteProxy = exports.PersonalizeProxy = exports.RedirectsProxy = exports.defineProxy = exports.ProxyHandler = exports.ProxyBase = void 0;
|
|
7
7
|
var proxy_1 = require("./proxy");
|
|
8
8
|
Object.defineProperty(exports, "ProxyBase", { enumerable: true, get: function () { return proxy_1.ProxyBase; } });
|
|
9
9
|
Object.defineProperty(exports, "ProxyHandler", { enumerable: true, get: function () { return proxy_1.ProxyHandler; } });
|
|
@@ -20,6 +20,8 @@ var locale_proxy_1 = require("./locale-proxy");
|
|
|
20
20
|
Object.defineProperty(exports, "LocaleProxy", { enumerable: true, get: function () { return locale_proxy_1.LocaleProxy; } });
|
|
21
21
|
var personalize_1 = require("@sitecore-content-sdk/content/personalize");
|
|
22
22
|
Object.defineProperty(exports, "PersonalizeService", { enumerable: true, get: function () { return personalize_1.PersonalizeService; } });
|
|
23
|
+
var bot_tracking_proxy_1 = require("./bot-tracking-proxy");
|
|
24
|
+
Object.defineProperty(exports, "BotTrackingProxy", { enumerable: true, get: function () { return bot_tracking_proxy_1.BotTrackingProxy; } });
|
|
23
25
|
var site_1 = require("@sitecore-content-sdk/content/site");
|
|
24
26
|
Object.defineProperty(exports, "RedirectsService", { enumerable: true, get: function () { return site_1.RedirectsService; } });
|
|
25
27
|
Object.defineProperty(exports, "REDIRECT_TYPE_301", { enumerable: true, get: function () { return site_1.REDIRECT_TYPE_301; } });
|
|
@@ -5,13 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PersonalizeProxy = void 0;
|
|
7
7
|
const personalize_1 = require("@sitecore-content-sdk/content/personalize");
|
|
8
|
-
const proxy_1 = require("./proxy");
|
|
9
8
|
const core_1 = require("@sitecore-content-sdk/core");
|
|
10
9
|
const personalize_2 = require("@sitecore-content-sdk/personalize");
|
|
11
|
-
const
|
|
10
|
+
const internal_1 = require("@sitecore-content-sdk/events/internal");
|
|
12
11
|
const analytics_core_1 = require("@sitecore-content-sdk/analytics-core");
|
|
13
|
-
const analytics_adapter_1 = require("../initialization/proxy/analytics-adapter");
|
|
14
12
|
const personalize_3 = require("@sitecore-content-sdk/personalize");
|
|
13
|
+
const analytics_adapter_1 = require("../initialization/proxy/analytics-adapter");
|
|
14
|
+
const proxy_1 = require("./proxy");
|
|
15
|
+
const debug_1 = __importDefault(require("../debug"));
|
|
15
16
|
const personalize_adapter_1 = require("../initialization/proxy/personalize-adapter");
|
|
16
17
|
/**
|
|
17
18
|
* Proxy / handler to support Sitecore Personalize
|
|
@@ -26,11 +27,13 @@ class PersonalizeProxy extends proxy_1.ProxyBase {
|
|
|
26
27
|
super(config);
|
|
27
28
|
this.config = config;
|
|
28
29
|
this.handle = async (req, res) => {
|
|
30
|
+
var _a, _b;
|
|
29
31
|
if (!this.config.enabled) {
|
|
30
32
|
debug_1.default.personalize('skipped (personalize proxy is disabled globally)');
|
|
31
33
|
return res;
|
|
32
34
|
}
|
|
33
35
|
try {
|
|
36
|
+
const skipForBot = (_a = this.config.skipForBot) !== null && _a !== void 0 ? _a : true;
|
|
34
37
|
const pathname = req.nextUrl.pathname;
|
|
35
38
|
const language = this.getLanguage(req, res);
|
|
36
39
|
const hostname = this.getHostHeader(req) || this.defaultHostname;
|
|
@@ -52,6 +55,10 @@ class PersonalizeProxy extends proxy_1.ProxyBase {
|
|
|
52
55
|
debug_1.default.personalize('skipped (%s)', res.redirected ? 'redirected' : 'preview');
|
|
53
56
|
return res;
|
|
54
57
|
}
|
|
58
|
+
if (skipForBot && ((_b = req.cookies.get(internal_1.BOT_DETECTION_COOKIE)) === null || _b === void 0 ? void 0 : _b.value)) {
|
|
59
|
+
debug_1.default.personalize('skipped (bot request)');
|
|
60
|
+
return res;
|
|
61
|
+
}
|
|
55
62
|
const site = this.getSite(req, res);
|
|
56
63
|
// Get personalization info from Experience Edge
|
|
57
64
|
// personalizeService is guaranteed to be non-null here because disabled() check passed
|
package/dist/cjs/proxy/proxy.js
CHANGED
|
@@ -17,6 +17,37 @@ exports.LOCALE_HEADER_NAME = 'x-sc-locale';
|
|
|
17
17
|
class ProxyHandler {
|
|
18
18
|
}
|
|
19
19
|
exports.ProxyHandler = ProxyHandler;
|
|
20
|
+
/**
|
|
21
|
+
* Hostname from a `Host` or `x-forwarded-host` value, without port.
|
|
22
|
+
* - `[::1]:3000` → `::1`
|
|
23
|
+
* - `127.0.0.1:3000` → `127.0.0.1`
|
|
24
|
+
* - `example.com:443` → `example.com`
|
|
25
|
+
* - `::1` → `::1` (does not treat `:1` as a port)
|
|
26
|
+
* @param {string} host - Raw header value
|
|
27
|
+
*/
|
|
28
|
+
function getHostnameFromHostHeader(host) {
|
|
29
|
+
const trimmed = host.trim();
|
|
30
|
+
// Bracketed IPv6: "[...]:port" or "[...]"
|
|
31
|
+
if (trimmed.startsWith('[')) {
|
|
32
|
+
const end = trimmed.indexOf(']');
|
|
33
|
+
if (end !== -1) {
|
|
34
|
+
return trimmed.slice(1, end).toLowerCase();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Unbracketed IPv6 (e.g. ::1, 2001:db8::1) — never strip on last ":digits"
|
|
38
|
+
if (trimmed.includes('::')) {
|
|
39
|
+
return trimmed.toLowerCase();
|
|
40
|
+
}
|
|
41
|
+
// IPv4 or DNS name with ":port" (port = decimal digits only)
|
|
42
|
+
const lastColon = trimmed.lastIndexOf(':');
|
|
43
|
+
if (lastColon > 0) {
|
|
44
|
+
const after = trimmed.slice(lastColon + 1);
|
|
45
|
+
if (/^\d+$/.test(after)) {
|
|
46
|
+
return trimmed.slice(0, lastColon).toLowerCase();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return trimmed.toLowerCase();
|
|
50
|
+
}
|
|
20
51
|
/**
|
|
21
52
|
* Base proxy class with common methods
|
|
22
53
|
* @public
|
|
@@ -113,8 +144,7 @@ class ProxyBase extends ProxyHandler {
|
|
|
113
144
|
* @param {NextRequest} req request
|
|
114
145
|
*/
|
|
115
146
|
getHostHeader(req) {
|
|
116
|
-
|
|
117
|
-
return req.headers.get('x-forwarded-host') || ((_a = req.headers.get('host')) === null || _a === void 0 ? void 0 : _a.split(':')[0]);
|
|
147
|
+
return getHostnameFromHostHeader(req.headers.get('x-forwarded-host') || req.headers.get('host') || '');
|
|
118
148
|
}
|
|
119
149
|
/**
|
|
120
150
|
* Get site information. If site name is stored in cookie, use it, otherwise resolve by hostname
|
|
@@ -13,6 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
13
|
import React, { forwardRef } from 'react';
|
|
14
14
|
import NextLink from 'next/link';
|
|
15
15
|
import { Link as ReactLink, } from '@sitecore-content-sdk/react';
|
|
16
|
+
import { useRouter as usePageRouter } from 'next/compat/router';
|
|
16
17
|
/**
|
|
17
18
|
* The list of NextLink props to be supported by the Link component.
|
|
18
19
|
*/
|
|
@@ -34,6 +35,7 @@ const FILE_EXTENSION_MATCHER = /^\/.*\.\w+$/;
|
|
|
34
35
|
* @public
|
|
35
36
|
*/
|
|
36
37
|
export const Link = forwardRef((props, ref) => {
|
|
38
|
+
const pageRouter = usePageRouter();
|
|
37
39
|
const { field, editable = true, children, internalLinkMatcher = /^\//g, showLinkTextWithChildrenPresent } = props, rest = __rest(props, ["field", "editable", "children", "internalLinkMatcher", "showLinkTextWithChildrenPresent"]);
|
|
38
40
|
if (!field || (!field.value && !field.href && !field.metadata)) {
|
|
39
41
|
return null;
|
|
@@ -48,10 +50,13 @@ export const Link = forwardRef((props, ref) => {
|
|
|
48
50
|
const isFileUrl = FILE_EXTENSION_MATCHER.test(href);
|
|
49
51
|
// determine if a link is a route or not. File extensions are not routes and should not be pre-fetched.
|
|
50
52
|
if (isMatching && !isFileUrl) {
|
|
51
|
-
return (React.createElement(NextLink, Object.assign({ href: { pathname: href, query: querystring, hash: anchor }, key: "link", title: value.title, target: value.target, className: value.class }, rest, {
|
|
53
|
+
return (React.createElement(NextLink, Object.assign({ href: { pathname: href, query: querystring, hash: anchor }, key: "link", title: value.title, target: value.target, className: value.class }, rest, {
|
|
54
|
+
// locale prop is supported only in Pages Router
|
|
55
|
+
locale: pageRouter ? false : undefined, ref: ref }, (process.env.TEST
|
|
52
56
|
? {
|
|
53
57
|
'data-nextjs-link': true,
|
|
54
58
|
'data-nextjs-prefetch': props.prefetch,
|
|
59
|
+
'data-nextjs-locale': pageRouter ? false : undefined,
|
|
55
60
|
}
|
|
56
61
|
: {})),
|
|
57
62
|
text,
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { initContentSdk } from '@sitecore-content-sdk/core';
|
|
2
|
+
import { analyticsPlugin } from '@sitecore-content-sdk/analytics-core';
|
|
3
|
+
import { eventsPlugin, botPageView, } from '@sitecore-content-sdk/events';
|
|
4
|
+
import { isBot, BOT_DETECTION_COOKIE } from '@sitecore-content-sdk/events/internal';
|
|
5
|
+
import { ProxyBase } from './proxy';
|
|
6
|
+
import debug from '../debug';
|
|
7
|
+
import { analyticsProxyAdapter } from '../initialization/proxy/analytics-adapter';
|
|
8
|
+
/**
|
|
9
|
+
* Next.js proxy that runs bot detection once per request and sets the bot cookie.
|
|
10
|
+
* Run first in the proxy chain to ensure that the bot cookie is set before other proxies run.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export class BotTrackingProxy extends ProxyBase {
|
|
14
|
+
constructor(config) {
|
|
15
|
+
super(config);
|
|
16
|
+
this.config = config;
|
|
17
|
+
this.handle = async (req, res) => {
|
|
18
|
+
try {
|
|
19
|
+
const isDisabled = (this.config.skip && this.config.skip(req, res)) || false;
|
|
20
|
+
debug.common('bot tracking proxy start: %o', {
|
|
21
|
+
pathname: req.nextUrl.pathname,
|
|
22
|
+
headers: this.extractDebugHeaders(req.headers),
|
|
23
|
+
});
|
|
24
|
+
if (isDisabled) {
|
|
25
|
+
debug.common('bot tracking proxy skipped (disabled)');
|
|
26
|
+
return res;
|
|
27
|
+
}
|
|
28
|
+
if (this.isPreview(req)) {
|
|
29
|
+
debug.common('bot tracking proxy skipped (preview)');
|
|
30
|
+
return res;
|
|
31
|
+
}
|
|
32
|
+
if (this.shouldSkipForLocalEnvironment(req)) {
|
|
33
|
+
debug.common('bot tracking proxy skipped (local environment)');
|
|
34
|
+
return res;
|
|
35
|
+
}
|
|
36
|
+
if (!isBot(req.headers.get('user-agent'))) {
|
|
37
|
+
debug.common('bot tracking proxy skipped (not a bot)');
|
|
38
|
+
return res;
|
|
39
|
+
}
|
|
40
|
+
if (this.isPrefetch(req)) {
|
|
41
|
+
debug.common('bot tracking proxy skipped (prefetch)');
|
|
42
|
+
return res;
|
|
43
|
+
}
|
|
44
|
+
const site = this.getSite(req, res);
|
|
45
|
+
const botTracking = async () => {
|
|
46
|
+
await initContentSdk({
|
|
47
|
+
config: {
|
|
48
|
+
contextId: this.config.contextId,
|
|
49
|
+
edgeUrl: this.config.edgeUrl,
|
|
50
|
+
siteName: site.name,
|
|
51
|
+
},
|
|
52
|
+
plugins: [
|
|
53
|
+
analyticsPlugin({
|
|
54
|
+
options: {
|
|
55
|
+
enableCookie: false,
|
|
56
|
+
},
|
|
57
|
+
adapter: analyticsProxyAdapter(req, res),
|
|
58
|
+
}),
|
|
59
|
+
eventsPlugin(),
|
|
60
|
+
],
|
|
61
|
+
});
|
|
62
|
+
await botPageView();
|
|
63
|
+
};
|
|
64
|
+
res.cookies.set(BOT_DETECTION_COOKIE, '1', {
|
|
65
|
+
secure: true,
|
|
66
|
+
sameSite: 'lax',
|
|
67
|
+
path: '/',
|
|
68
|
+
});
|
|
69
|
+
if (this.config.fetchEvent) {
|
|
70
|
+
this.config.fetchEvent.waitUntil(botTracking());
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
await botTracking();
|
|
74
|
+
}
|
|
75
|
+
debug.common('bot tracking proxy end: %o', {
|
|
76
|
+
pathname: req.nextUrl.pathname,
|
|
77
|
+
cookies: res.cookies,
|
|
78
|
+
});
|
|
79
|
+
return res;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
debug.common('bot tracking proxy error: %o', error);
|
|
83
|
+
return res;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @param {NextRequest} req - Incoming request
|
|
89
|
+
* @returns True when bot tracking should be skipped for a local / dev environment.
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
shouldSkipForLocalEnvironment(req) {
|
|
93
|
+
// Allow bot tracking in local environment for development purposes
|
|
94
|
+
if (process.env.SITECORE_ENABLE_BOT_TRACKING === 'true') {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
if (process.env.NODE_ENV === 'development') {
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
const hostName = (this.getHostHeader(req) ||
|
|
101
|
+
req.nextUrl.hostname ||
|
|
102
|
+
this.defaultHostname ||
|
|
103
|
+
'').toLowerCase();
|
|
104
|
+
return (hostName === 'localhost' ||
|
|
105
|
+
hostName === '127.0.0.1' ||
|
|
106
|
+
hostName === '::1' ||
|
|
107
|
+
hostName === '[::1]');
|
|
108
|
+
}
|
|
109
|
+
}
|
package/dist/esm/proxy/index.js
CHANGED
|
@@ -5,5 +5,6 @@ export { MultisiteProxy } from './multisite-proxy';
|
|
|
5
5
|
export { AppRouterMultisiteProxy } from './app-router-multisite-proxy';
|
|
6
6
|
export { LocaleProxy } from './locale-proxy';
|
|
7
7
|
export { PersonalizeService, } from '@sitecore-content-sdk/content/personalize';
|
|
8
|
+
export { BotTrackingProxy } from './bot-tracking-proxy';
|
|
8
9
|
export { RedirectsService, REDIRECT_TYPE_301, REDIRECT_TYPE_302, REDIRECT_TYPE_SERVER_TRANSFER, } from '@sitecore-content-sdk/content/site';
|
|
9
10
|
export { default as debug } from '../debug';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { PersonalizeService, getPersonalizedRewrite, CdpHelper, DEFAULT_VARIANT, } from '@sitecore-content-sdk/content/personalize';
|
|
2
|
-
import { ProxyBase, REWRITE_HEADER_NAME } from './proxy';
|
|
3
2
|
import { initContentSdk } from '@sitecore-content-sdk/core';
|
|
4
3
|
import { personalize } from '@sitecore-content-sdk/personalize';
|
|
5
|
-
import
|
|
4
|
+
import { BOT_DETECTION_COOKIE } from '@sitecore-content-sdk/events/internal';
|
|
6
5
|
import { analyticsPlugin } from '@sitecore-content-sdk/analytics-core';
|
|
7
|
-
import { analyticsProxyAdapter } from '../initialization/proxy/analytics-adapter';
|
|
8
6
|
import { personalizeServerPlugin } from '@sitecore-content-sdk/personalize';
|
|
7
|
+
import { analyticsProxyAdapter } from '../initialization/proxy/analytics-adapter';
|
|
8
|
+
import { ProxyBase, REWRITE_HEADER_NAME } from './proxy';
|
|
9
|
+
import debug from '../debug';
|
|
9
10
|
import { personalizeProxyAdapter } from '../initialization/proxy/personalize-adapter';
|
|
10
11
|
/**
|
|
11
12
|
* Proxy / handler to support Sitecore Personalize
|
|
@@ -20,11 +21,13 @@ export class PersonalizeProxy extends ProxyBase {
|
|
|
20
21
|
super(config);
|
|
21
22
|
this.config = config;
|
|
22
23
|
this.handle = async (req, res) => {
|
|
24
|
+
var _a, _b;
|
|
23
25
|
if (!this.config.enabled) {
|
|
24
26
|
debug.personalize('skipped (personalize proxy is disabled globally)');
|
|
25
27
|
return res;
|
|
26
28
|
}
|
|
27
29
|
try {
|
|
30
|
+
const skipForBot = (_a = this.config.skipForBot) !== null && _a !== void 0 ? _a : true;
|
|
28
31
|
const pathname = req.nextUrl.pathname;
|
|
29
32
|
const language = this.getLanguage(req, res);
|
|
30
33
|
const hostname = this.getHostHeader(req) || this.defaultHostname;
|
|
@@ -46,6 +49,10 @@ export class PersonalizeProxy extends ProxyBase {
|
|
|
46
49
|
debug.personalize('skipped (%s)', res.redirected ? 'redirected' : 'preview');
|
|
47
50
|
return res;
|
|
48
51
|
}
|
|
52
|
+
if (skipForBot && ((_b = req.cookies.get(BOT_DETECTION_COOKIE)) === null || _b === void 0 ? void 0 : _b.value)) {
|
|
53
|
+
debug.personalize('skipped (bot request)');
|
|
54
|
+
return res;
|
|
55
|
+
}
|
|
49
56
|
const site = this.getSite(req, res);
|
|
50
57
|
// Get personalization info from Experience Edge
|
|
51
58
|
// personalizeService is guaranteed to be non-null here because disabled() check passed
|
package/dist/esm/proxy/proxy.js
CHANGED
|
@@ -10,6 +10,37 @@ export const LOCALE_HEADER_NAME = 'x-sc-locale';
|
|
|
10
10
|
*/
|
|
11
11
|
export class ProxyHandler {
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Hostname from a `Host` or `x-forwarded-host` value, without port.
|
|
15
|
+
* - `[::1]:3000` → `::1`
|
|
16
|
+
* - `127.0.0.1:3000` → `127.0.0.1`
|
|
17
|
+
* - `example.com:443` → `example.com`
|
|
18
|
+
* - `::1` → `::1` (does not treat `:1` as a port)
|
|
19
|
+
* @param {string} host - Raw header value
|
|
20
|
+
*/
|
|
21
|
+
function getHostnameFromHostHeader(host) {
|
|
22
|
+
const trimmed = host.trim();
|
|
23
|
+
// Bracketed IPv6: "[...]:port" or "[...]"
|
|
24
|
+
if (trimmed.startsWith('[')) {
|
|
25
|
+
const end = trimmed.indexOf(']');
|
|
26
|
+
if (end !== -1) {
|
|
27
|
+
return trimmed.slice(1, end).toLowerCase();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// Unbracketed IPv6 (e.g. ::1, 2001:db8::1) — never strip on last ":digits"
|
|
31
|
+
if (trimmed.includes('::')) {
|
|
32
|
+
return trimmed.toLowerCase();
|
|
33
|
+
}
|
|
34
|
+
// IPv4 or DNS name with ":port" (port = decimal digits only)
|
|
35
|
+
const lastColon = trimmed.lastIndexOf(':');
|
|
36
|
+
if (lastColon > 0) {
|
|
37
|
+
const after = trimmed.slice(lastColon + 1);
|
|
38
|
+
if (/^\d+$/.test(after)) {
|
|
39
|
+
return trimmed.slice(0, lastColon).toLowerCase();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return trimmed.toLowerCase();
|
|
43
|
+
}
|
|
13
44
|
/**
|
|
14
45
|
* Base proxy class with common methods
|
|
15
46
|
* @public
|
|
@@ -106,8 +137,7 @@ export class ProxyBase extends ProxyHandler {
|
|
|
106
137
|
* @param {NextRequest} req request
|
|
107
138
|
*/
|
|
108
139
|
getHostHeader(req) {
|
|
109
|
-
|
|
110
|
-
return req.headers.get('x-forwarded-host') || ((_a = req.headers.get('host')) === null || _a === void 0 ? void 0 : _a.split(':')[0]);
|
|
140
|
+
return getHostnameFromHostHeader(req.headers.get('x-forwarded-host') || req.headers.get('host') || '');
|
|
111
141
|
}
|
|
112
142
|
/**
|
|
113
143
|
* Get site information. If site name is stored in cookie, use it, otherwise resolve by hostname
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-content-sdk/nextjs",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.1.0-canary.1",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"url": "https://github.com/sitecore/content-sdk/issues"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@sitecore-content-sdk/analytics-core": "
|
|
36
|
-
"@sitecore-content-sdk/personalize": "
|
|
35
|
+
"@sitecore-content-sdk/analytics-core": "2.1.0-canary.1",
|
|
36
|
+
"@sitecore-content-sdk/personalize": "2.1.0-canary.1",
|
|
37
37
|
"@stylistic/eslint-plugin": "^5.2.2",
|
|
38
38
|
"@testing-library/dom": "^10.4.0",
|
|
39
39
|
"@testing-library/react": "^16.3.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"glob": "^11.0.2",
|
|
64
64
|
"jsdom": "^26.1.0",
|
|
65
65
|
"mocha": "^11.2.2",
|
|
66
|
-
"next": "^16.
|
|
66
|
+
"next": "^16.2.0",
|
|
67
67
|
"nock": "14.0.0-beta.7",
|
|
68
68
|
"nyc": "^17.1.0",
|
|
69
69
|
"prettier": "^2.8.0",
|
|
@@ -76,10 +76,10 @@
|
|
|
76
76
|
"typescript": "~5.8.3"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@sitecore-content-sdk/analytics-core": "^2.0.2",
|
|
80
|
-
"@sitecore-content-sdk/events": "^2.0.2",
|
|
81
|
-
"@sitecore-content-sdk/personalize": "^2.0.2",
|
|
82
|
-
"next": "^16.
|
|
79
|
+
"@sitecore-content-sdk/analytics-core": "^2.0.2-canary.2",
|
|
80
|
+
"@sitecore-content-sdk/events": "^2.0.2-canary.2",
|
|
81
|
+
"@sitecore-content-sdk/personalize": "^2.0.2-canary.2",
|
|
82
|
+
"next": "^16.2.0",
|
|
83
83
|
"react": "^19.2.1",
|
|
84
84
|
"react-dom": "^19.2.1",
|
|
85
85
|
"typescript": "^5.4.0"
|
|
@@ -91,9 +91,10 @@
|
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@babel/parser": "^7.27.2",
|
|
94
|
-
"@sitecore-content-sdk/content": "
|
|
95
|
-
"@sitecore-content-sdk/core": "
|
|
96
|
-
"@sitecore-content-sdk/
|
|
94
|
+
"@sitecore-content-sdk/content": "2.1.0-canary.1",
|
|
95
|
+
"@sitecore-content-sdk/core": "2.1.0-canary.1",
|
|
96
|
+
"@sitecore-content-sdk/events": "2.1.0-canary.1",
|
|
97
|
+
"@sitecore-content-sdk/react": "2.1.0-canary.1",
|
|
97
98
|
"recast": "^0.23.11",
|
|
98
99
|
"regex-parser": "^2.3.1",
|
|
99
100
|
"sync-disk-cache": "^2.1.0"
|
|
@@ -177,7 +178,7 @@
|
|
|
177
178
|
},
|
|
178
179
|
"description": "",
|
|
179
180
|
"types": "types/index.d.ts",
|
|
180
|
-
"gitHead": "
|
|
181
|
+
"gitHead": "59794666566c6d47740b8e505ad8186c09363d64",
|
|
181
182
|
"files": [
|
|
182
183
|
"dist",
|
|
183
184
|
"types",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/components/Link.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAC/C,OAAiB,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAIL,SAAS,IAAI,cAAc,EAC5B,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/components/Link.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAC/C,OAAiB,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAIL,SAAS,IAAI,cAAc,EAC5B,MAAM,6BAA6B,CAAC;AAGrC;;GAEG;AACH,QAAA,MAAM,sBAAsB,uFAQlB,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,cAAc,GAAG;IACvC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAOjE;;;GAGG;AACH,eAAO,MAAM,IAAI,kGAqEhB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { NextFetchEvent, NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import { SitecoreConfig } from '@sitecore-content-sdk/content/config';
|
|
3
|
+
import { ProxyBase, ProxyBaseConfig } from './proxy';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for BotTrackingProxy.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export type BotTrackingProxyConfig = SitecoreConfig['api']['edge'] & Omit<ProxyBaseConfig, 'defaultLanguage'> & {
|
|
9
|
+
/**
|
|
10
|
+
* Fetch event to run the bot tracking in the background to not block the request.
|
|
11
|
+
* If not provided, the bot tracking will run synchronously.
|
|
12
|
+
* Read more about `fetchEvent` in the [Next.js documentation](https://nextjs.org/docs/app/api-reference/file-conventions/proxy#waituntil-and-nextfetchevent)
|
|
13
|
+
* @param {NextFetchEvent} fetchEvent - Fetch event to run the bot tracking in the background.
|
|
14
|
+
*/
|
|
15
|
+
fetchEvent?: NextFetchEvent;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Next.js proxy that runs bot detection once per request and sets the bot cookie.
|
|
19
|
+
* Run first in the proxy chain to ensure that the bot cookie is set before other proxies run.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare class BotTrackingProxy extends ProxyBase {
|
|
23
|
+
protected config: BotTrackingProxyConfig;
|
|
24
|
+
constructor(config: BotTrackingProxyConfig);
|
|
25
|
+
handle: (req: NextRequest, res: NextResponse) => Promise<NextResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* @param {NextRequest} req - Incoming request
|
|
28
|
+
* @returns True when bot tracking should be skipped for a local / dev environment.
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
protected shouldSkipForLocalEnvironment(req: NextRequest): boolean;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=bot-tracking-proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bot-tracking-proxy.d.ts","sourceRoot":"","sources":["../../src/proxy/bot-tracking-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAOtE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAIrD;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAChE,IAAI,CAAC,eAAe,EAAE,iBAAiB,CAAC,GAAG;IACzC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B,CAAC;AAEJ;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;IACjC,SAAS,CAAC,MAAM,EAAE,sBAAsB;gBAA9B,MAAM,EAAE,sBAAsB;IAIpD,MAAM,GAAU,KAAK,WAAW,EAAE,KAAK,YAAY,KAAG,OAAO,CAAC,YAAY,CAAC,CA+EzE;IAEF;;;;OAIG;IACH,SAAS,CAAC,6BAA6B,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO;CAwBnE"}
|
package/types/proxy/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { MultisiteProxy, MultisiteProxyConfig } from './multisite-proxy';
|
|
|
5
5
|
export { AppRouterMultisiteProxy } from './app-router-multisite-proxy';
|
|
6
6
|
export { LocaleProxy, LocaleProxyConfig } from './locale-proxy';
|
|
7
7
|
export { PersonalizeService, PersonalizeServiceConfig, } from '@sitecore-content-sdk/content/personalize';
|
|
8
|
+
export { BotTrackingProxy, BotTrackingProxyConfig } from './bot-tracking-proxy';
|
|
8
9
|
export { RedirectsService, RedirectsServiceConfig, REDIRECT_TYPE_301, REDIRECT_TYPE_302, REDIRECT_TYPE_SERVER_TRANSFER, RedirectInfo, } from '@sitecore-content-sdk/content/site';
|
|
9
10
|
export { default as debug } from '../debug';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/proxy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,6BAA6B,EAC7B,YAAY,GACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/proxy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,6BAA6B,EAC7B,YAAY,GACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -19,6 +19,11 @@ export type PersonalizeProxyConfig = ProxyBaseConfig & SitecoreConfig['api']['ed
|
|
|
19
19
|
personalizeService?: PersonalizeService;
|
|
20
20
|
getExtraUtmParams?: (req: NextRequest) => Partial<ExperienceParams['utm']>;
|
|
21
21
|
extractGeoDataCb?: (req?: NextRequest) => Promise<PersonalizeGeoData> | PersonalizeGeoData;
|
|
22
|
+
/**
|
|
23
|
+
* Skip personalize proxy for bot requests marked by the bot tracking proxy.
|
|
24
|
+
* Default is `true`.
|
|
25
|
+
*/
|
|
26
|
+
skipForBot?: boolean;
|
|
22
27
|
};
|
|
23
28
|
/**
|
|
24
29
|
* Object model of Experience Context data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"personalize-proxy.d.ts","sourceRoot":"","sources":["../../src/proxy/personalize-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,kBAAkB,EAElB,eAAe,EAGhB,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"personalize-proxy.d.ts","sourceRoot":"","sources":["../../src/proxy/personalize-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,kBAAkB,EAElB,eAAe,EAGhB,MAAM,2CAA2C,CAAC;AAOnD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAuB,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAI3C;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAClD,cAAc,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAC7B,cAAc,CAAC,aAAa,CAAC,GAAG;IAC9B,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3E,gBAAgB,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;IAC3F;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE;QACH,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;QAClC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;QAC3B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;QAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;KAC7B,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,KAAK,oBAAoB,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;IAMjC,SAAS,CAAC,MAAM,EAAE,sBAAsB;IALpD,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAExD;;OAEG;gBACmB,MAAM,EAAE,sBAAsB;IAmCpD,MAAM,GAAU,KAAK,WAAW,EAAE,KAAK,YAAY,KAAG,OAAO,CAAC,YAAY,CAAC,CAwIzE;IAEF,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,GAAG,SAAS;IAU5E,SAAS,CAAC,mBAAmB,CAAC,GAAG,EAAE,WAAW,GAAG,gBAAgB;cAkBjD,qBAAqB,CAAC,EACpC,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,GACT,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,WAAW,CAAC;QACrB,QAAQ,EAAE,YAAY,CAAC;KACxB,GAAG,OAAO,CAAC,IAAI,CAAC;cAyBD,WAAW,CAAC,EAC1B,MAAM,EACN,UAAU,EACV,QAAQ,EACR,OAAO,EACP,UAAU,EACV,GAAG,GACJ,EAAE;QACD,MAAM,EAAE,gBAAgB,CAAC;QACzB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,GAAG,CAAC,EAAE,kBAAkB,CAAC;KAC1B;mBAec,MAAM;;IAIrB;;;;;OAKG;IACH,SAAS,CAAC,wBAAwB,CAChC,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,MAAM,GACf,oBAAoB,EAAE;CA8C1B"}
|
package/types/proxy/proxy.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ export declare abstract class ProxyBase extends ProxyHandler {
|
|
|
97
97
|
* Extract 'host' header
|
|
98
98
|
* @param {NextRequest} req request
|
|
99
99
|
*/
|
|
100
|
-
protected getHostHeader(req: NextRequest): string
|
|
100
|
+
protected getHostHeader(req: NextRequest): string;
|
|
101
101
|
/**
|
|
102
102
|
* Get site information. If site name is stored in cookie, use it, otherwise resolve by hostname
|
|
103
103
|
* - If site can't be resolved by site name cookie use default site info based on provided parameters
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/proxy/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,QAAQ,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAEL,oBAAoB,EACrB,MAAM,sCAAsC,CAAC;AAI9C,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAClD,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;OAIG;IACH,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC;IACxD;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,8BAAsB,YAAY;IAChC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;CAC5E;
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/proxy/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,QAAQ,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAEL,oBAAoB,EACrB,MAAM,sCAAsC,CAAC;AAI9C,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAClD,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;OAIG;IACH,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC;IACxD;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,8BAAsB,YAAY;IAChC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;CAC5E;AAsCD;;;GAGG;AACH,8BAAsB,SAAU,SAAQ,YAAY;IAItC,SAAS,CAAC,MAAM,EAAE,eAAe;IAH7C,SAAS,CAAC,eAAe,EAAE,MAAM,CAAC;IAClC,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;gBAEf,MAAM,EAAE,eAAe;IAM7C;;;;OAIG;IACH,SAAS,CAAC,SAAS,CAAC,GAAG,EAAE,WAAW;IAOpC;;;;OAIG;IACH,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO;IAIjD;;;;OAIG;IACH,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO;IAmB/C,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY;IAWtD;;;;;OAKG;IACH,SAAS,CAAC,mBAAmB,CAAC,eAAe,EAAE,OAAO;;;IAMtD;;;;;OAKG;IACH,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,YAAY,GAAG,MAAM;IAUnE;;;;;OAKG;IACH,SAAS,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS;IAIvE;;;OAGG;IACH,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,WAAW;IAMxC;;;;;;;OAOG;IACH,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,YAAY,GAAG,QAAQ;IAoBjE,SAAS,CAAC,gBAAgB,CAAC,cAAc,EAAE,oBAAoB,GAAG,2BAA2B;IAI7F;;;;;;OAMG;IACH,SAAS,CAAC,OAAO,CACf,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,YAAY,EACjB,UAAU,CAAC,EAAE,OAAO,GACnB,YAAY;CAchB;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,GAAG,SAAS,YAAY,EAAE;IAElD;;;;OAIG;gBACe,WAAW,QAAQ,YAAY;CAiBpD,CAAC"}
|