@sitecore-jss/sitecore-jss-react 21.0.0-canary.98 → 21.0.0
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/README.md +8 -10
- package/dist/cjs/components/Link.js +34 -11
- package/dist/cjs/components/Placeholder.js +29 -1
- package/dist/cjs/components/VisitorIdentification.js +2 -1
- package/dist/cjs/enhancers/withComponentFactory.js +13 -3
- package/dist/cjs/enhancers/withEditorChromes.js +1 -5
- package/dist/cjs/enhancers/withSitecoreContext.js +21 -4
- package/dist/cjs/index.js +1 -4
- package/dist/esm/components/Link.js +15 -10
- package/dist/esm/components/Placeholder.js +30 -2
- package/dist/esm/components/VisitorIdentification.js +2 -1
- package/dist/esm/enhancers/withComponentFactory.js +13 -3
- package/dist/esm/enhancers/withEditorChromes.js +0 -4
- package/dist/esm/enhancers/withSitecoreContext.js +3 -2
- package/dist/esm/index.js +2 -2
- package/package.json +6 -5
- package/types/components/Link.d.ts +2 -2
- package/types/components/Placeholder.d.ts +4 -1
- package/types/components/VisitorIdentification.d.ts +5 -1
- package/types/enhancers/withComponentFactory.d.ts +4 -1
- package/types/enhancers/withEditorChromes.d.ts +0 -4
- package/types/enhancers/withPlaceholder.d.ts +4 -1
- package/types/index.d.ts +2 -2
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.
|
package/README.md
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
# Sitecore JavaScript Rendering SDK for React
|
|
2
|
-
|
|
3
|
-
This module is provided as a part of Sitecore JavaScript Rendering SDK (JSS). It contains React components and integration for JSS.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
[
|
|
9
|
-
|
|
10
|
-
[API reference documentation](/ref-docs/sitecore-jss-react/).
|
|
1
|
+
# Sitecore JavaScript Rendering SDK for React
|
|
2
|
+
|
|
3
|
+
This module is provided as a part of Sitecore JavaScript Rendering SDK (JSS). It contains React components and integration for JSS.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[Documentation (Experience Platform)](https://doc.sitecore.com/xp/en/developers/hd/201/sitecore-headless-development/sitecore-javascript-rendering-sdk--jss--for-react.html)
|
|
7
|
+
|
|
8
|
+
[API reference documentation](/ref-docs/sitecore-jss-react/)
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
2
21
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
22
|
var t = {};
|
|
4
23
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -15,10 +34,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
34
|
};
|
|
16
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
36
|
exports.LinkPropTypes = exports.Link = void 0;
|
|
18
|
-
const react_1 =
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
19
38
|
const prop_types_1 = __importDefault(require("prop-types"));
|
|
20
|
-
const
|
|
21
|
-
|
|
39
|
+
const html_react_parser_1 = __importDefault(require("html-react-parser"));
|
|
40
|
+
exports.Link = react_1.forwardRef((_a, ref) => {
|
|
41
|
+
var { field, editable, showLinkTextWithChildrenPresent } = _a, otherProps = __rest(_a, ["field", "editable", "showLinkTextWithChildrenPresent"]);
|
|
42
|
+
const children = otherProps.children;
|
|
22
43
|
const dynamicField = field;
|
|
23
44
|
if (!field ||
|
|
24
45
|
(!dynamicField.editableFirstPart &&
|
|
@@ -34,10 +55,13 @@ const Link = (_a) => {
|
|
|
34
55
|
// However, we cannot combine arbitrary unparsed HTML (innerHTML) based components with actual vDOM components (the children)
|
|
35
56
|
// because the innerHTML is not parsed - it'd make a discontinuous vDOM. So, we'll go for the next best compromise of rendering the link field and children separately
|
|
36
57
|
// as siblings. Should be "good enough" for most cases - and write your own helper if it isn't. Or bring xEditor out of 2006.
|
|
37
|
-
const htmlProps = Object.assign(Object.assign({ className: 'sc-link-wrapper',
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
58
|
+
const htmlProps = Object.assign(Object.assign({ className: 'sc-link-wrapper' }, otherProps), { key: 'editable' });
|
|
59
|
+
const components = html_react_parser_1.default(markup, {
|
|
60
|
+
htmlparser2: {
|
|
61
|
+
lowerCaseTags: false,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
resultTags.push(react_1.default.createElement("span", Object.assign({}, htmlProps), components));
|
|
41
65
|
// don't render normal link tag when editing, if no children exist
|
|
42
66
|
// this preserves normal-ish behavior if not using a link body (no hacks required)
|
|
43
67
|
if (!children) {
|
|
@@ -62,14 +86,13 @@ const Link = (_a) => {
|
|
|
62
86
|
anchorAttrs.rel = 'noopener noreferrer';
|
|
63
87
|
}
|
|
64
88
|
const linkText = showLinkTextWithChildrenPresent || !children ? link.text || link.href : null;
|
|
65
|
-
resultTags.push(react_1.default.createElement('a', Object.assign(Object.assign(Object.assign({}, anchorAttrs), otherProps), { key: 'link' }), linkText, children));
|
|
89
|
+
resultTags.push(react_1.default.createElement('a', Object.assign(Object.assign(Object.assign({}, anchorAttrs), otherProps), { key: 'link', ref }), linkText, children));
|
|
66
90
|
return react_1.default.createElement(react_1.default.Fragment, null, resultTags);
|
|
67
|
-
};
|
|
68
|
-
exports.Link = Link;
|
|
91
|
+
});
|
|
69
92
|
exports.LinkPropTypes = {
|
|
70
93
|
field: prop_types_1.default.oneOfType([
|
|
71
94
|
prop_types_1.default.shape({
|
|
72
|
-
href: prop_types_1.default.string,
|
|
95
|
+
href: prop_types_1.default.oneOfType([prop_types_1.default.string.isRequired, prop_types_1.default.oneOf([null]).isRequired]),
|
|
73
96
|
}),
|
|
74
97
|
prop_types_1.default.shape({
|
|
75
98
|
value: prop_types_1.default.object,
|
|
@@ -50,8 +50,36 @@ class PlaceholderComponent extends PlaceholderCommon_1.PlaceholderCommon {
|
|
|
50
50
|
}
|
|
51
51
|
const renderingData = childProps.rendering;
|
|
52
52
|
const placeholderData = PlaceholderCommon_1.PlaceholderCommon.getPlaceholderDataFromRenderingData(renderingData, this.props.name);
|
|
53
|
-
const components = this.getComponentsForRenderingData(placeholderData);
|
|
54
53
|
this.isEmpty = placeholderData.every((rendering) => isRawRendering(rendering));
|
|
54
|
+
// This is a workaround to insert Experience Editor-specific markup on the page for empty placeholders.
|
|
55
|
+
// It makes sure the markup is inserted by react and thus avoiding hydration errors when in editing mode
|
|
56
|
+
if (this.isEmpty && utils_1.ExperienceEditor.isActive()) {
|
|
57
|
+
const codePos = placeholderData.findIndex((component) => component.name === 'code' &&
|
|
58
|
+
component.attributes.kind === 'open');
|
|
59
|
+
const plhId = placeholderData[codePos].attributes.id;
|
|
60
|
+
const emptyPlaceholderMarkup = [
|
|
61
|
+
{
|
|
62
|
+
name: 'span',
|
|
63
|
+
contents: null,
|
|
64
|
+
attributes: {
|
|
65
|
+
type: 'text/sitecore',
|
|
66
|
+
'sc-part-of': 'placeholder rendering',
|
|
67
|
+
style: 'display: none;',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'div',
|
|
72
|
+
contents: null,
|
|
73
|
+
attributes: {
|
|
74
|
+
class: 'scEnabledChrome scEmptyPlaceholder',
|
|
75
|
+
'sc-part-of': 'placeholder',
|
|
76
|
+
'sc-placeholder-id': plhId,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
placeholderData.splice(codePos + 1, 0, ...emptyPlaceholderMarkup);
|
|
81
|
+
}
|
|
82
|
+
const components = this.getComponentsForRenderingData(placeholderData);
|
|
55
83
|
if (this.props.renderEmpty && this.isEmpty) {
|
|
56
84
|
const rendered = this.props.renderEmpty(components);
|
|
57
85
|
return components.length ? this.renderEmptyPlaceholder(rendered) : rendered;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VisitorIdentification = void 0;
|
|
4
4
|
const withSitecoreContext_1 = require("../enhancers/withSitecoreContext");
|
|
5
5
|
let emittedVI = false;
|
|
6
|
-
const VIComponent = () => {
|
|
6
|
+
const VIComponent = (props) => {
|
|
7
7
|
const { sitecoreContext } = withSitecoreContext_1.useSitecoreContext();
|
|
8
8
|
if (emittedVI ||
|
|
9
9
|
typeof document === 'undefined' ||
|
|
@@ -16,6 +16,7 @@ const VIComponent = () => {
|
|
|
16
16
|
const script = document.createElement('script');
|
|
17
17
|
script.src = '/layouts/system/VisitorIdentification.js';
|
|
18
18
|
script.type = 'text/javascript';
|
|
19
|
+
script.defer = props.defer;
|
|
19
20
|
const meta = document.createElement('meta');
|
|
20
21
|
meta.name = 'VIcurrentDateTime';
|
|
21
22
|
meta.content = sitecoreContext.visitorIdentificationTimestamp.toString();
|
|
@@ -6,12 +6,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.withComponentFactory = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const SitecoreContext_1 = require("../components/SitecoreContext");
|
|
9
|
+
const react_2 = require("react");
|
|
9
10
|
/**
|
|
10
11
|
* @param {React.ComponentClass<T> | React.FC<T>} Component
|
|
11
12
|
*/
|
|
12
13
|
function withComponentFactory(Component) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* @param {T} props - props to pass to the wrapped component
|
|
16
|
+
* @returns {JSX.Element} - the rendered component
|
|
17
|
+
*/
|
|
18
|
+
function WithComponentFactory(props) {
|
|
19
|
+
const context = react_2.useContext(SitecoreContext_1.ComponentFactoryReactContext);
|
|
20
|
+
return react_1.default.createElement(Component, Object.assign({}, props, { componentFactory: props.componentFactory || context }));
|
|
21
|
+
}
|
|
22
|
+
WithComponentFactory.displayName = `withComponentFactory(${Component.displayName ||
|
|
23
|
+
Component.name ||
|
|
24
|
+
'Anonymous'})`;
|
|
25
|
+
return WithComponentFactory;
|
|
16
26
|
}
|
|
17
27
|
exports.withComponentFactory = withComponentFactory;
|
|
@@ -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.
|
|
6
|
+
exports.withEditorChromes = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const __1 = require("..");
|
|
9
9
|
const withEditorChromes = (WrappedComponent) => {
|
|
@@ -22,7 +22,3 @@ const withEditorChromes = (WrappedComponent) => {
|
|
|
22
22
|
return Enhancer;
|
|
23
23
|
};
|
|
24
24
|
exports.withEditorChromes = withEditorChromes;
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated Will be removed in a future release. Please use withEditorChromes instead.
|
|
27
|
-
*/
|
|
28
|
-
exports.withExperienceEditorChromes = exports.withEditorChromes;
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
4
20
|
};
|
|
5
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
22
|
exports.useSitecoreContext = exports.withSitecoreContext = void 0;
|
|
7
|
-
const react_1 =
|
|
23
|
+
const react_1 = __importStar(require("react"));
|
|
8
24
|
const SitecoreContext_1 = require("../components/SitecoreContext");
|
|
9
25
|
/**
|
|
10
26
|
* @param {WithSitecoreContextOptions} [options]
|
|
@@ -12,7 +28,8 @@ const SitecoreContext_1 = require("../components/SitecoreContext");
|
|
|
12
28
|
function withSitecoreContext(options) {
|
|
13
29
|
return function withSitecoreContextHoc(Component) {
|
|
14
30
|
return function WithSitecoreContext(props) {
|
|
15
|
-
|
|
31
|
+
const context = react_1.useContext(SitecoreContext_1.SitecoreContextReactContext);
|
|
32
|
+
return (react_1.default.createElement(Component, Object.assign({}, props, { sitecoreContext: context.context, updateSitecoreContext: options && options.updatable && context.setContext })));
|
|
16
33
|
};
|
|
17
34
|
};
|
|
18
35
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withDatasourceCheck = exports.withPlaceholder = exports.
|
|
3
|
+
exports.withDatasourceCheck = exports.withPlaceholder = exports.withEditorChromes = exports.useSitecoreContext = exports.withSitecoreContext = exports.SitecoreContextReactContext = exports.SitecoreContext = exports.VisitorIdentification = exports.File = exports.LinkPropTypes = exports.Link = exports.DateField = exports.Text = exports.RichTextPropTypes = exports.RichText = exports.getEEMarkup = exports.Image = exports.Placeholder = exports.mediaApi = exports.RestDictionaryService = exports.GraphQLDictionaryService = exports.trackingApi = exports.getFieldValue = exports.getChildPlaceholder = exports.RestLayoutService = exports.GraphQLLayoutService = exports.LayoutServicePageState = exports.resetEditorChromes = exports.isEditorActive = exports.enableDebug = exports.constants = void 0;
|
|
4
4
|
var sitecore_jss_1 = require("@sitecore-jss/sitecore-jss");
|
|
5
5
|
Object.defineProperty(exports, "constants", { enumerable: true, get: function () { return sitecore_jss_1.constants; } });
|
|
6
6
|
Object.defineProperty(exports, "enableDebug", { enumerable: true, get: function () { return sitecore_jss_1.enableDebug; } });
|
|
7
7
|
var utils_1 = require("@sitecore-jss/sitecore-jss/utils");
|
|
8
|
-
Object.defineProperty(exports, "isExperienceEditorActive", { enumerable: true, get: function () { return utils_1.isExperienceEditorActive; } });
|
|
9
|
-
Object.defineProperty(exports, "resetExperienceEditorChromes", { enumerable: true, get: function () { return utils_1.resetExperienceEditorChromes; } });
|
|
10
8
|
Object.defineProperty(exports, "isEditorActive", { enumerable: true, get: function () { return utils_1.isEditorActive; } });
|
|
11
9
|
Object.defineProperty(exports, "resetEditorChromes", { enumerable: true, get: function () { return utils_1.resetEditorChromes; } });
|
|
12
10
|
var layout_1 = require("@sitecore-jss/sitecore-jss/layout");
|
|
@@ -49,7 +47,6 @@ Object.defineProperty(exports, "withSitecoreContext", { enumerable: true, get: f
|
|
|
49
47
|
Object.defineProperty(exports, "useSitecoreContext", { enumerable: true, get: function () { return withSitecoreContext_1.useSitecoreContext; } });
|
|
50
48
|
var withEditorChromes_1 = require("./enhancers/withEditorChromes");
|
|
51
49
|
Object.defineProperty(exports, "withEditorChromes", { enumerable: true, get: function () { return withEditorChromes_1.withEditorChromes; } });
|
|
52
|
-
Object.defineProperty(exports, "withExperienceEditorChromes", { enumerable: true, get: function () { return withEditorChromes_1.withExperienceEditorChromes; } });
|
|
53
50
|
var withPlaceholder_1 = require("./enhancers/withPlaceholder");
|
|
54
51
|
Object.defineProperty(exports, "withPlaceholder", { enumerable: true, get: function () { return withPlaceholder_1.withPlaceholder; } });
|
|
55
52
|
var withDatasourceCheck_1 = require("./enhancers/withDatasourceCheck");
|
|
@@ -9,10 +9,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import React from 'react';
|
|
12
|
+
import React, { forwardRef } from 'react';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
import parse from 'html-react-parser';
|
|
15
|
+
export const Link = forwardRef((_a, ref) => {
|
|
16
|
+
var { field, editable, showLinkTextWithChildrenPresent } = _a, otherProps = __rest(_a, ["field", "editable", "showLinkTextWithChildrenPresent"]);
|
|
17
|
+
const children = otherProps.children;
|
|
16
18
|
const dynamicField = field;
|
|
17
19
|
if (!field ||
|
|
18
20
|
(!dynamicField.editableFirstPart &&
|
|
@@ -28,10 +30,13 @@ export const Link = (_a) => {
|
|
|
28
30
|
// However, we cannot combine arbitrary unparsed HTML (innerHTML) based components with actual vDOM components (the children)
|
|
29
31
|
// because the innerHTML is not parsed - it'd make a discontinuous vDOM. So, we'll go for the next best compromise of rendering the link field and children separately
|
|
30
32
|
// as siblings. Should be "good enough" for most cases - and write your own helper if it isn't. Or bring xEditor out of 2006.
|
|
31
|
-
const htmlProps = Object.assign(Object.assign({ className: 'sc-link-wrapper',
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const htmlProps = Object.assign(Object.assign({ className: 'sc-link-wrapper' }, otherProps), { key: 'editable' });
|
|
34
|
+
const components = parse(markup, {
|
|
35
|
+
htmlparser2: {
|
|
36
|
+
lowerCaseTags: false,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
resultTags.push(React.createElement("span", Object.assign({}, htmlProps), components));
|
|
35
40
|
// don't render normal link tag when editing, if no children exist
|
|
36
41
|
// this preserves normal-ish behavior if not using a link body (no hacks required)
|
|
37
42
|
if (!children) {
|
|
@@ -56,13 +61,13 @@ export const Link = (_a) => {
|
|
|
56
61
|
anchorAttrs.rel = 'noopener noreferrer';
|
|
57
62
|
}
|
|
58
63
|
const linkText = showLinkTextWithChildrenPresent || !children ? link.text || link.href : null;
|
|
59
|
-
resultTags.push(React.createElement('a', Object.assign(Object.assign(Object.assign({}, anchorAttrs), otherProps), { key: 'link' }), linkText, children));
|
|
64
|
+
resultTags.push(React.createElement('a', Object.assign(Object.assign(Object.assign({}, anchorAttrs), otherProps), { key: 'link', ref }), linkText, children));
|
|
60
65
|
return React.createElement(React.Fragment, null, resultTags);
|
|
61
|
-
};
|
|
66
|
+
});
|
|
62
67
|
export const LinkPropTypes = {
|
|
63
68
|
field: PropTypes.oneOfType([
|
|
64
69
|
PropTypes.shape({
|
|
65
|
-
href: PropTypes.string,
|
|
70
|
+
href: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.oneOf([null]).isRequired]),
|
|
66
71
|
}),
|
|
67
72
|
PropTypes.shape({
|
|
68
73
|
value: PropTypes.object,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PlaceholderCommon } from './PlaceholderCommon';
|
|
3
3
|
import { withComponentFactory } from '../enhancers/withComponentFactory';
|
|
4
|
-
import { HorizonEditor } from '@sitecore-jss/sitecore-jss/utils';
|
|
4
|
+
import { HorizonEditor, ExperienceEditor } from '@sitecore-jss/sitecore-jss/utils';
|
|
5
5
|
/**
|
|
6
6
|
* @param {HtmlElementRendering | ComponentRendering} rendering
|
|
7
7
|
*/
|
|
@@ -44,8 +44,36 @@ class PlaceholderComponent extends PlaceholderCommon {
|
|
|
44
44
|
}
|
|
45
45
|
const renderingData = childProps.rendering;
|
|
46
46
|
const placeholderData = PlaceholderCommon.getPlaceholderDataFromRenderingData(renderingData, this.props.name);
|
|
47
|
-
const components = this.getComponentsForRenderingData(placeholderData);
|
|
48
47
|
this.isEmpty = placeholderData.every((rendering) => isRawRendering(rendering));
|
|
48
|
+
// This is a workaround to insert Experience Editor-specific markup on the page for empty placeholders.
|
|
49
|
+
// It makes sure the markup is inserted by react and thus avoiding hydration errors when in editing mode
|
|
50
|
+
if (this.isEmpty && ExperienceEditor.isActive()) {
|
|
51
|
+
const codePos = placeholderData.findIndex((component) => component.name === 'code' &&
|
|
52
|
+
component.attributes.kind === 'open');
|
|
53
|
+
const plhId = placeholderData[codePos].attributes.id;
|
|
54
|
+
const emptyPlaceholderMarkup = [
|
|
55
|
+
{
|
|
56
|
+
name: 'span',
|
|
57
|
+
contents: null,
|
|
58
|
+
attributes: {
|
|
59
|
+
type: 'text/sitecore',
|
|
60
|
+
'sc-part-of': 'placeholder rendering',
|
|
61
|
+
style: 'display: none;',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'div',
|
|
66
|
+
contents: null,
|
|
67
|
+
attributes: {
|
|
68
|
+
class: 'scEnabledChrome scEmptyPlaceholder',
|
|
69
|
+
'sc-part-of': 'placeholder',
|
|
70
|
+
'sc-placeholder-id': plhId,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
placeholderData.splice(codePos + 1, 0, ...emptyPlaceholderMarkup);
|
|
75
|
+
}
|
|
76
|
+
const components = this.getComponentsForRenderingData(placeholderData);
|
|
49
77
|
if (this.props.renderEmpty && this.isEmpty) {
|
|
50
78
|
const rendered = this.props.renderEmpty(components);
|
|
51
79
|
return components.length ? this.renderEmptyPlaceholder(rendered) : rendered;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useSitecoreContext } from '../enhancers/withSitecoreContext';
|
|
2
2
|
let emittedVI = false;
|
|
3
|
-
const VIComponent = () => {
|
|
3
|
+
const VIComponent = (props) => {
|
|
4
4
|
const { sitecoreContext } = useSitecoreContext();
|
|
5
5
|
if (emittedVI ||
|
|
6
6
|
typeof document === 'undefined' ||
|
|
@@ -13,6 +13,7 @@ const VIComponent = () => {
|
|
|
13
13
|
const script = document.createElement('script');
|
|
14
14
|
script.src = '/layouts/system/VisitorIdentification.js';
|
|
15
15
|
script.type = 'text/javascript';
|
|
16
|
+
script.defer = props.defer;
|
|
16
17
|
const meta = document.createElement('meta');
|
|
17
18
|
meta.name = 'VIcurrentDateTime';
|
|
18
19
|
meta.content = sitecoreContext.visitorIdentificationTimestamp.toString();
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentFactoryReactContext } from '../components/SitecoreContext';
|
|
3
|
+
import { useContext } from 'react';
|
|
3
4
|
/**
|
|
4
5
|
* @param {React.ComponentClass<T> | React.FC<T>} Component
|
|
5
6
|
*/
|
|
6
7
|
export function withComponentFactory(Component) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @param {T} props - props to pass to the wrapped component
|
|
10
|
+
* @returns {JSX.Element} - the rendered component
|
|
11
|
+
*/
|
|
12
|
+
function WithComponentFactory(props) {
|
|
13
|
+
const context = useContext(ComponentFactoryReactContext);
|
|
14
|
+
return React.createElement(Component, Object.assign({}, props, { componentFactory: props.componentFactory || context }));
|
|
15
|
+
}
|
|
16
|
+
WithComponentFactory.displayName = `withComponentFactory(${Component.displayName ||
|
|
17
|
+
Component.name ||
|
|
18
|
+
'Anonymous'})`;
|
|
19
|
+
return WithComponentFactory;
|
|
10
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import { SitecoreContextReactContext } from '../components/SitecoreContext';
|
|
3
3
|
/**
|
|
4
4
|
* @param {WithSitecoreContextOptions} [options]
|
|
@@ -6,7 +6,8 @@ import { SitecoreContextReactContext } from '../components/SitecoreContext';
|
|
|
6
6
|
export function withSitecoreContext(options) {
|
|
7
7
|
return function withSitecoreContextHoc(Component) {
|
|
8
8
|
return function WithSitecoreContext(props) {
|
|
9
|
-
|
|
9
|
+
const context = useContext(SitecoreContextReactContext);
|
|
10
|
+
return (React.createElement(Component, Object.assign({}, props, { sitecoreContext: context.context, updateSitecoreContext: options && options.updatable && context.setContext })));
|
|
10
11
|
};
|
|
11
12
|
};
|
|
12
13
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { constants, enableDebug } from '@sitecore-jss/sitecore-jss';
|
|
2
|
-
export {
|
|
2
|
+
export { isEditorActive, resetEditorChromes } from '@sitecore-jss/sitecore-jss/utils';
|
|
3
3
|
export { LayoutServicePageState, GraphQLLayoutService, RestLayoutService, getChildPlaceholder, getFieldValue, } from '@sitecore-jss/sitecore-jss/layout';
|
|
4
4
|
export { trackingApi, } from '@sitecore-jss/sitecore-jss/tracking';
|
|
5
5
|
export { GraphQLDictionaryService, RestDictionaryService, } from '@sitecore-jss/sitecore-jss/i18n';
|
|
@@ -14,6 +14,6 @@ export { File } from './components/File';
|
|
|
14
14
|
export { VisitorIdentification } from './components/VisitorIdentification';
|
|
15
15
|
export { SitecoreContext, SitecoreContextReactContext, } from './components/SitecoreContext';
|
|
16
16
|
export { withSitecoreContext, useSitecoreContext, } from './enhancers/withSitecoreContext';
|
|
17
|
-
export { withEditorChromes
|
|
17
|
+
export { withEditorChromes } from './enhancers/withEditorChromes';
|
|
18
18
|
export { withPlaceholder } from './enhancers/withPlaceholder';
|
|
19
19
|
export { withDatasourceCheck } from './enhancers/withDatasourceCheck';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-jss/sitecore-jss-react",
|
|
3
|
-
"version": "21.0.0
|
|
3
|
+
"version": "21.0.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@types/chai": "^4.2.2",
|
|
31
31
|
"@types/chai-string": "^1.4.2",
|
|
32
32
|
"@types/deep-equal": "^1.0.1",
|
|
33
|
-
"@types/enzyme": "^3.10.
|
|
33
|
+
"@types/enzyme": "^3.10.12",
|
|
34
34
|
"@types/mocha": "^9.0.0",
|
|
35
35
|
"@types/node": "17.0.40",
|
|
36
36
|
"@types/prop-types": "^15.7.4",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"chai": "^4.2.0",
|
|
43
43
|
"chai-string": "^1.5.0",
|
|
44
44
|
"cheerio": "1.0.0-rc.10",
|
|
45
|
-
"del-cli": "^
|
|
45
|
+
"del-cli": "^5.0.0",
|
|
46
46
|
"enzyme": "^3.11.0",
|
|
47
47
|
"eslint": "^7.15.0",
|
|
48
48
|
"eslint-plugin-react": "^7.21.5",
|
|
@@ -61,14 +61,15 @@
|
|
|
61
61
|
"react-dom": "^18.1.0"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@sitecore-jss/sitecore-jss": "^21.0.0
|
|
64
|
+
"@sitecore-jss/sitecore-jss": "^21.0.0",
|
|
65
65
|
"deep-equal": "^2.0.5",
|
|
66
|
+
"html-react-parser": "^3.0.0",
|
|
66
67
|
"prop-types": "^15.7.2",
|
|
67
68
|
"style-attr": "^1.3.0"
|
|
68
69
|
},
|
|
69
70
|
"description": "",
|
|
70
71
|
"types": "types/index.d.ts",
|
|
71
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "e91b32f87b033eb4c26a765590c578fe037e839d",
|
|
72
73
|
"files": [
|
|
73
74
|
"dist",
|
|
74
75
|
"types"
|
|
@@ -30,10 +30,10 @@ export declare type LinkProps = React.DetailedHTMLProps<React.AnchorHTMLAttribut
|
|
|
30
30
|
*/
|
|
31
31
|
showLinkTextWithChildrenPresent?: boolean;
|
|
32
32
|
};
|
|
33
|
-
export declare const Link: React.
|
|
33
|
+
export declare const Link: React.ForwardRefExoticComponent<Pick<LinkProps, "key" | "editable" | "field" | "showLinkTextWithChildrenPresent" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement>> & React.RefAttributes<HTMLAnchorElement>>;
|
|
34
34
|
export declare const LinkPropTypes: {
|
|
35
35
|
field: PropTypes.Validator<PropTypes.InferProps<{
|
|
36
|
-
href: PropTypes.Requireable<
|
|
36
|
+
href: PropTypes.Requireable<any>;
|
|
37
37
|
}> | PropTypes.InferProps<{
|
|
38
38
|
value: PropTypes.Requireable<object>;
|
|
39
39
|
editableFirstPart: PropTypes.Requireable<string>;
|
|
@@ -18,4 +18,7 @@ export interface PlaceholderComponentProps extends PlaceholderProps {
|
|
|
18
18
|
*/
|
|
19
19
|
renderEach?: (component: React.ReactNode, index: number) => React.ReactNode;
|
|
20
20
|
}
|
|
21
|
-
export declare const Placeholder:
|
|
21
|
+
export declare const Placeholder: {
|
|
22
|
+
(props: PlaceholderComponentProps): JSX.Element;
|
|
23
|
+
displayName: string;
|
|
24
|
+
};
|
|
@@ -6,4 +6,7 @@ export interface ComponentFactoryProps {
|
|
|
6
6
|
/**
|
|
7
7
|
* @param {React.ComponentClass<T> | React.FC<T>} Component
|
|
8
8
|
*/
|
|
9
|
-
export declare function withComponentFactory<T extends ComponentFactoryProps>(Component: React.ComponentClass<T> | React.FC<T>):
|
|
9
|
+
export declare function withComponentFactory<T extends ComponentFactoryProps>(Component: React.ComponentClass<T> | React.FC<T>): {
|
|
10
|
+
(props: T): JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const withEditorChromes: (WrappedComponent: React.ComponentClass<unknown> | React.FC<unknown>) => React.ComponentClass<{}, any>;
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Will be removed in a future release. Please use withEditorChromes instead.
|
|
5
|
-
*/
|
|
6
|
-
export declare const withExperienceEditorChromes: (WrappedComponent: React.ComponentClass<unknown> | React.FC<unknown>) => React.ComponentClass<{}, any>;
|
|
@@ -31,4 +31,7 @@ export declare type WithPlaceholderSpec = (string | PlaceholderToPropMapping) |
|
|
|
31
31
|
* @param {WithPlaceholderSpec} placeholders
|
|
32
32
|
* @param {WithPlaceholderOptions} [options]
|
|
33
33
|
*/
|
|
34
|
-
export declare function withPlaceholder(placeholders: WithPlaceholderSpec, options?: WithPlaceholderOptions): (WrappedComponent: React.ComponentClass<PlaceholderProps> | React.FunctionComponent<PlaceholderProps>) =>
|
|
34
|
+
export declare function withPlaceholder(placeholders: WithPlaceholderSpec, options?: WithPlaceholderOptions): (WrappedComponent: React.ComponentClass<PlaceholderProps> | React.FunctionComponent<PlaceholderProps>) => {
|
|
35
|
+
(props: PlaceholderProps): JSX.Element;
|
|
36
|
+
displayName: string;
|
|
37
|
+
};
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { constants, enableDebug } from '@sitecore-jss/sitecore-jss';
|
|
2
|
-
export {
|
|
2
|
+
export { isEditorActive, resetEditorChromes } from '@sitecore-jss/sitecore-jss/utils';
|
|
3
3
|
export { LayoutService, LayoutServiceData, LayoutServicePageState, LayoutServiceContext, LayoutServiceContextData, GraphQLLayoutService, RestLayoutService, RouteData, Field, Item, HtmlElementRendering, getChildPlaceholder, getFieldValue, ComponentRendering, ComponentFields, ComponentParams, } from '@sitecore-jss/sitecore-jss/layout';
|
|
4
4
|
export { trackingApi, TrackingRequestOptions, CampaignInstance, GoalInstance, OutcomeInstance, EventInstance, PageViewInstance, } from '@sitecore-jss/sitecore-jss/tracking';
|
|
5
5
|
export { DictionaryPhrases, DictionaryService, GraphQLDictionaryService, RestDictionaryService, } from '@sitecore-jss/sitecore-jss/i18n';
|
|
@@ -15,6 +15,6 @@ export { File, FileField } from './components/File';
|
|
|
15
15
|
export { VisitorIdentification } from './components/VisitorIdentification';
|
|
16
16
|
export { SitecoreContext, SitecoreContextState, SitecoreContextValue, SitecoreContextReactContext, } from './components/SitecoreContext';
|
|
17
17
|
export { withSitecoreContext, useSitecoreContext, ComponentConsumerProps, WithSitecoreContextOptions, WithSitecoreContextProps, WithSitecoreContextHocProps, } from './enhancers/withSitecoreContext';
|
|
18
|
-
export { withEditorChromes
|
|
18
|
+
export { withEditorChromes } from './enhancers/withEditorChromes';
|
|
19
19
|
export { withPlaceholder } from './enhancers/withPlaceholder';
|
|
20
20
|
export { withDatasourceCheck } from './enhancers/withDatasourceCheck';
|