@sitecore-jss/sitecore-jss-react-native 22.4.1 → 22.5.0-beta.2
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 +10 -10
- package/dist/components/Date.js +1 -1
- package/dist/components/Date.test.js +1 -1
- package/dist/components/Image.js +1 -1
- package/dist/components/Image.test.js +1 -1
- package/dist/components/Link.js +1 -1
- package/dist/components/MissingComponent.js +1 -1
- package/dist/components/MissingComponent.test.js +1 -1
- package/dist/components/Placeholder.js +1 -1
- package/dist/components/Placeholder.test.js +1 -1
- package/dist/components/RichText.js +1 -1
- package/dist/components/RichText.test.js +1 -1
- package/dist/components/SitecoreContext.js +1 -1
- package/dist/components/Text.js +1 -1
- package/dist/components/Text.test.js +1 -1
- package/dist/components/UnrenderableComponent.js +1 -1
- package/dist/enhancers/withComponentFactory.js +1 -1
- package/dist/enhancers/withComponentFactory.test.js +1 -1
- package/package.json +3 -3
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,10 @@
|
|
|
1
|
-
# Sitecore JavaScript Rendering SDK for React Native
|
|
2
|
-
|
|
3
|
-
This module is provided as a part of Sitecore JavaScript Rendering SDK (JSS). It contains the integration for React Native (services & components).
|
|
4
|
-
|
|
5
|
-
<!---
|
|
6
|
-
@TODO: Update to next version docs before release
|
|
7
|
-
-->
|
|
8
|
-
[Documentation (Experience Platform)](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/sitecore-javascript-rendering-sdk--jss--for-react-native.html)
|
|
9
|
-
|
|
10
|
-
[API reference documentation](/ref-docs/sitecore-jss-react-native/)
|
|
1
|
+
# Sitecore JavaScript Rendering SDK for React Native
|
|
2
|
+
|
|
3
|
+
This module is provided as a part of Sitecore JavaScript Rendering SDK (JSS). It contains the integration for React Native (services & components).
|
|
4
|
+
|
|
5
|
+
<!---
|
|
6
|
+
@TODO: Update to next version docs before release
|
|
7
|
+
-->
|
|
8
|
+
[Documentation (Experience Platform)](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/sitecore-javascript-rendering-sdk--jss--for-react-native.html)
|
|
9
|
+
|
|
10
|
+
[API reference documentation](/ref-docs/sitecore-jss-react-native/)
|
package/dist/components/Date.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.DateField=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNative=require("react-native");var _reactNativeHtmlview=_interopRequireDefault(require("react-native-htmlview"));var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.DateField=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNative=require("react-native");var _reactNativeHtmlview=_interopRequireDefault(require("react-native-htmlview"));var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/Date.tsx";var _excluded=["field","editable","render"];var DateField=exports.DateField=function DateField(_ref){var field=_ref.field,editable=_ref.editable,render=_ref.render,otherProps=(0,_objectWithoutProperties2["default"])(_ref,_excluded);if(!field||!field.editable&&!field.value){return null;}if(field.editable&&editable){return _react["default"].createElement(_reactNativeHtmlview["default"],(0,_extends2["default"])({value:field.editable},otherProps,{__source:{fileName:_jsxFileName,lineNumber:33,columnNumber:12}}));}var children;if(render){children=render(field.value?new Date(field.value):null);}else{children=field.value;}return render?_react["default"].createElement(_react["default"].Fragment,null,children):_react["default"].createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:44,columnNumber:37}},children);};DateField.propTypes={field:_propTypes["default"].shape({value:_propTypes["default"].any,editable:_propTypes["default"].string}).isRequired,editable:_propTypes["default"].bool,render:_propTypes["default"].func};DateField.defaultProps={editable:true};DateField.displayName='Date';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireDefault(require("react"));var _reactTestRenderer=_interopRequireDefault(require("react-test-renderer"));var _reactNative=require("react-native");var _Date=require("./Date");var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireDefault(require("react"));var _reactTestRenderer=_interopRequireDefault(require("react-test-renderer"));var _reactNative=require("react-native");var _Date=require("./Date");var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/Date.test.tsx";describe('<DateField />',function(){test('should render nothing with missing field',function(){var p={field:{}};var c=_reactTestRenderer["default"].create(_react["default"].createElement(_Date.DateField,(0,_extends2["default"])({},p,{__source:{fileName:_jsxFileName,lineNumber:12,columnNumber:31}})));var instance=c.getInstance();expect(instance&&instance.children).toEqual(null);expect(c).toMatchSnapshot();});test('should render value',function(){var p={field:{value:'xxx'}};var c=_reactTestRenderer["default"].create(_react["default"].createElement(_Date.DateField,(0,_extends2["default"])({},p,{__source:{fileName:_jsxFileName,lineNumber:27,columnNumber:31}})));expect(c).toMatchSnapshot();});test('should render value using render function',function(){var render=function render(date){return _react["default"].createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:34,columnNumber:7}},_react["default"].createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:35,columnNumber:9}},"Test test test..."),_react["default"].createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:36,columnNumber:9}},date?date.toDateString():''));};var p={field:{value:'10-23-2003'},render:render};var c=_reactTestRenderer["default"].create(_react["default"].createElement(_Date.DateField,(0,_extends2["default"])({},p,{__source:{fileName:_jsxFileName,lineNumber:47,columnNumber:31}})));expect(c).toMatchSnapshot();});});
|
package/dist/components/Image.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.isSvgImage=exports.Image=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNative=require("react-native");var _reactNativeSvgUri=_interopRequireDefault(require("react-native-svg-uri"));var _media=require("@sitecore-jss/sitecore-jss/media");var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.isSvgImage=exports.Image=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNative=require("react-native");var _reactNativeSvgUri=_interopRequireDefault(require("react-native-svg-uri"));var _media=require("@sitecore-jss/sitecore-jss/media");var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/Image.tsx";var _excluded=["src","width","height","style"],_excluded2=["media","imageUrlParams","field"];function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){(0,_defineProperty2["default"])(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}var getImageAttrs=function getImageAttrs(_ref,imageUrlParams){var src=_ref.src,width=_ref.width,height=_ref.height,style=_ref.style,otherAttrs=(0,_objectWithoutProperties2["default"])(_ref,_excluded);if(!src){return null;}var newAttrs=_objectSpread({},otherAttrs);var imgStyles={};if(width){imgStyles.width=typeof width!=='number'?Number(width):width;}if(height){imgStyles.height=typeof height!=='number'?Number(height):height;}if(typeof src==='number'){newAttrs.source=src;}else{var uri=_media.mediaApi.updateImageUrl(src,imageUrlParams);newAttrs.source={uri:uri};}if(isSvgImage(newAttrs.source)){newAttrs.style=_objectSpread(_objectSpread({},style||{}),imgStyles);}else{newAttrs.style=style?[imgStyles,style]:imgStyles;}return newAttrs;};var isSvgImage=exports.isSvgImage=function isSvgImage(source){var isSvg=/\.svg($|\?|\&)/g;var src=_reactNative.Image.resolveAssetSource(source);return src&&isSvg.test(src.uri);};var Image=exports.Image=function Image(_ref2){var media=_ref2.media,imageUrlParams=_ref2.imageUrlParams,field=_ref2.field,otherProps=(0,_objectWithoutProperties2["default"])(_ref2,_excluded2);var dynamicMedia=media;if(field&&!media){dynamicMedia=field;}if(!dynamicMedia||!dynamicMedia.value&&!dynamicMedia.src){return null;}var img=dynamicMedia.src?dynamicMedia:dynamicMedia.value;if(!img){return null;}var attrs=getImageAttrs(_objectSpread(_objectSpread({},img),otherProps),imageUrlParams);if(attrs&&isSvgImage(attrs.source))return _react["default"].createElement(_reactNativeSvgUri["default"],(0,_extends2["default"])({},attrs,{__source:{fileName:_jsxFileName,lineNumber:126,columnNumber:72}}));if(attrs)return _react["default"].createElement(_reactNative.Image,(0,_extends2["default"])({},attrs,{source:attrs.source,__source:{fileName:_jsxFileName,lineNumber:128,columnNumber:21}}));return null;};Image.propTypes={media:_propTypes["default"].oneOfType([_propTypes["default"].shape({src:_propTypes["default"].oneOfType([_propTypes["default"].string,_propTypes["default"].number])}),_propTypes["default"].shape({value:_propTypes["default"].object})]),imageUrlParams:_propTypes["default"].any};Image.displayName='Image';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireDefault(require("react"));var _reactTestRenderer=_interopRequireDefault(require("react-test-renderer"));var _reactNative=require("react-native");var _Image=require("./Image");var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireDefault(require("react"));var _reactTestRenderer=_interopRequireDefault(require("react-test-renderer"));var _reactNative=require("react-native");var _Image=require("./Image");var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/Image.test.tsx";function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){(0,_defineProperty2["default"])(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}var staticImages={'test-image-1':{src:1}};var networkImages={'test-image-1':{src:'https://jssapp/-/media/myfile.ashx&w=180&h=360',width:180,height:360,alt:'Logo'}};var testData=[{label:'static images',data:staticImages},{label:'network images',data:networkImages}];describe('<Image />',function(){testData.forEach(function(dataSet){describe("with ".concat(dataSet.label),function(){describe('with direct image object, no value/editable',function(){test('should render properly',function(){var props={media:dataSet.data['test-image-1'],resizeMode:'cover'};var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_Image.Image,(0,_extends2["default"])({},props,{__source:{fileName:_jsxFileName,lineNumber:41,columnNumber:44}})));expect(rendered).toMatchSnapshot();});});describe('with value/editable image object',function(){test('should render properly',function(){var props={media:{value:dataSet.data['test-image-1'],editable:'bob loblaw'},resizeMode:'cover'};var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_Image.Image,(0,_extends2["default"])({},props,{__source:{fileName:_jsxFileName,lineNumber:56,columnNumber:44}})));expect(rendered).toMatchSnapshot();});});describe('with style prop',function(){describe('with width or height specified in field data',function(){test('should render merged styles',function(){var styles=_reactNative.StyleSheet.create({logoImage:{margin:20}});var props={media:{value:_objectSpread(_objectSpread({},dataSet.data['test-image-1']),{},{width:'180',height:'360'}),editable:'bob loblaw'},style:styles.logoImage,resizeMode:'cover'};var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_Image.Image,(0,_extends2["default"])({},props,{__source:{fileName:_jsxFileName,lineNumber:82,columnNumber:46}})));expect(rendered).toMatchSnapshot();});});});});});test('isSvgImage',function(){var ut=function ut(source,expected){return expect((0,_Image.isSvgImage)(source)).toEqual(expected);};ut({uri:'./x.svg'},true);ut({uri:'./x.png'},false);ut({uri:'https://jssapp/-/media/myfile.svg&w=180'},true);ut({uri:'https://jssapp/-/media/myfile.svg?w=180'},true);ut({uri:'https://jssapp/-/media/myfile.png?w=180'},false);});});
|
package/dist/components/Link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Link=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNativeHtmlview=_interopRequireDefault(require("react-native-htmlview"));var _reactNative=require("react-native");var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Link=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNativeHtmlview=_interopRequireDefault(require("react-native-htmlview"));var _reactNative=require("react-native");var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/Link.tsx";var _excluded=["field","editable","children","showLinkTextWithChildrenPresent","style","textStyle"];var Link=exports.Link=function Link(_ref){var field=_ref.field,editable=_ref.editable,children=_ref.children,showLinkTextWithChildrenPresent=_ref.showLinkTextWithChildrenPresent,style=_ref.style,textStyle=_ref.textStyle,otherProps=(0,_objectWithoutProperties2["default"])(_ref,_excluded);var dynamicField=field;if(!field||!dynamicField.editableFirstPart&&!dynamicField.value&&!dynamicField.href){return null;}var resultTags=[];var _ref2=dynamicField,editableFirstPart=_ref2.editableFirstPart,editableLastPart=_ref2.editableLastPart;if(editable&&editableFirstPart){var markup=editableFirstPart+editableLastPart;resultTags.push(_react["default"].createElement(_reactNativeHtmlview["default"],{value:markup,__source:{fileName:_jsxFileName,lineNumber:71,columnNumber:21}}));if(!children){return resultTags[0];}}var link=dynamicField.href?field:dynamicField.value;if(!link){return null;}var linkText=showLinkTextWithChildrenPresent||!children?link.text||link.href:null;resultTags.push(_react["default"].createElement(_reactNative.TouchableWithoutFeedback,(0,_extends2["default"])({onPress:function onPress(){return link.href&&_reactNative.Linking.openURL(link.href);},key:"link"},otherProps,{__source:{fileName:_jsxFileName,lineNumber:92,columnNumber:5}}),_react["default"].createElement(_reactNative.View,{style:style,__source:{fileName:_jsxFileName,lineNumber:97,columnNumber:7}},linkText&&_react["default"].createElement(_reactNative.Text,{style:textStyle,__source:{fileName:_jsxFileName,lineNumber:98,columnNumber:22}},linkText),children)));return _react["default"].createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:104,columnNumber:10}},resultTags);};Link.propTypes={field:_propTypes["default"].oneOfType([_propTypes["default"].shape({href:_propTypes["default"].string}),_propTypes["default"].shape({value:_propTypes["default"].object,editableFirstPart:_propTypes["default"].string,editableLastPart:_propTypes["default"].string})]).isRequired,editable:_propTypes["default"].bool};Link.defaultProps={editable:true};Link.displayName='Link';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.MissingComponent=void 0;var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNative=require("react-native");var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.MissingComponent=void 0;var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNative=require("react-native");var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/MissingComponent.tsx";var styles=_reactNative.StyleSheet.create({container:{backgroundColor:'darkorange',padding:10,flex:1},title:{fontSize:22,fontWeight:'bold',marginVertical:20,color:'white'},text:{color:'white',marginVertical:20}});var MissingComponent=exports.MissingComponent=function MissingComponent(props){var componentName=props.rendering&&props.rendering.componentName?props.rendering.componentName:'Unnamed Component';return _react["default"].createElement(_reactNative.View,{style:styles.container,__source:{fileName:_jsxFileName,lineNumber:36,columnNumber:5}},_react["default"].createElement(_reactNative.Text,{style:styles.title,__source:{fileName:_jsxFileName,lineNumber:37,columnNumber:7}},componentName),_react["default"].createElement(_reactNative.Text,{style:styles.text,__source:{fileName:_jsxFileName,lineNumber:38,columnNumber:7}},"JSS component is missing React Native implementation."));};MissingComponent.propTypes={rendering:_propTypes["default"].shape({componentName:_propTypes["default"].string})};MissingComponent.displayName='MissingComponent';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireDefault(require("react"));var _reactTestRenderer=_interopRequireDefault(require("react-test-renderer"));var _MissingComponent=require("./MissingComponent");var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireDefault(require("react"));var _reactTestRenderer=_interopRequireDefault(require("react-test-renderer"));var _MissingComponent=require("./MissingComponent");var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/MissingComponent.test.tsx";describe('<MissingComponent />',function(){test('should render without component name',function(){var p={rendering:{}};var c=_reactTestRenderer["default"].create(_react["default"].createElement(_MissingComponent.MissingComponent,(0,_extends2["default"])({},p,{__source:{fileName:_jsxFileName,lineNumber:11,columnNumber:31}})));expect(c).toMatchSnapshot();});test('should render with component name',function(){var p={rendering:{componentName:'TestComponent'}};var c=_reactTestRenderer["default"].create(_react["default"].createElement(_MissingComponent.MissingComponent,(0,_extends2["default"])({},p,{__source:{fileName:_jsxFileName,lineNumber:23,columnNumber:31}})));expect(c).toMatchSnapshot();});});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Placeholder=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _withComponentFactory=require("../enhancers/withComponentFactory");var _PlaceholderCommon2=require("./PlaceholderCommon");var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Placeholder=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _withComponentFactory=require("../enhancers/withComponentFactory");var _PlaceholderCommon2=require("./PlaceholderCommon");var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/Placeholder.tsx";function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){(0,_defineProperty2["default"])(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _callSuper(t,o,e){return o=(0,_getPrototypeOf2["default"])(o),(0,_possibleConstructorReturn2["default"])(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],(0,_getPrototypeOf2["default"])(t).constructor):o.apply(t,e));}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function isRawRendering(rendering){return!rendering.componentName&&rendering.name!==undefined;}var PlaceholderComponent=function(_PlaceholderCommon){function PlaceholderComponent(props){(0,_classCallCheck2["default"])(this,PlaceholderComponent);return _callSuper(this,PlaceholderComponent,[props]);}(0,_inherits2["default"])(PlaceholderComponent,_PlaceholderCommon);return(0,_createClass2["default"])(PlaceholderComponent,[{key:"render",value:function render(){var props=this.props;var childProps=_objectSpread({},this.props);delete childProps.componentFactory;delete childProps.render;delete childProps.renderEach;if(this.state.error){return _react["default"].createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:66,columnNumber:14}},"A rendering error occurred: ",this.state.error.message,".");}var renderingData=childProps.rendering;var placeholderData=_PlaceholderCommon2.PlaceholderCommon.getPlaceholderDataFromRenderingData(renderingData,props.name);var components=this.getComponentsForRenderingData(placeholderData);if(props.renderEmpty&&placeholderData.every(function(rendering){return isRawRendering(rendering);})){return components&&props.renderEmpty(components,placeholderData,childProps);}else if(props.render){return components&&props.render(components,placeholderData,childProps);}else if(props.renderEach){return components&&components.map(function(component,index){if(component&&component.props&&component.props.type==='text/sitecore'){return component;}return props.renderEach&&props.renderEach(component,index);});}else{return components;}}}]);}(_PlaceholderCommon2.PlaceholderCommon);(0,_defineProperty2["default"])(PlaceholderComponent,"propTypes",_PlaceholderCommon2.PlaceholderCommon.propTypes);var Placeholder=exports.Placeholder=(0,_withComponentFactory.withComponentFactory)(PlaceholderComponent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _reactNative=require("react-native");var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactTestRenderer=_interopRequireDefault(require("react-test-renderer"));var _Placeholder=require("./Placeholder");var _SitecoreContext=require("./SitecoreContext");var _devData=require("../../test-data/dev-data");var _LSDataEEOff=require("../../test-data/LS-data-EE-off");var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _reactNative=require("react-native");var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactTestRenderer=_interopRequireDefault(require("react-test-renderer"));var _Placeholder=require("./Placeholder");var _SitecoreContext=require("./SitecoreContext");var _devData=require("../../test-data/dev-data");var _LSDataEEOff=require("../../test-data/LS-data-EE-off");var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/Placeholder.test.tsx";var _excluded=["rendering"];var componentFactory=function componentFactory(componentName){var components=new Map();var Home=function Home(_ref){var rendering=_ref.rendering,otherProps=(0,_objectWithoutProperties2["default"])(_ref,_excluded);return _react["default"].createElement(_reactNative.View,{testID:"home-mock",__source:{fileName:_jsxFileName,lineNumber:17,columnNumber:5}},_react["default"].createElement(_Placeholder.Placeholder,{name:"page-header",rendering:rendering,__source:{fileName:_jsxFileName,lineNumber:18,columnNumber:7}}),_react["default"].createElement(_Placeholder.Placeholder,(0,_extends2["default"])({name:"page-content",rendering:rendering},otherProps,{__source:{fileName:_jsxFileName,lineNumber:19,columnNumber:7}})));};Home.propTypes={placeholders:_propTypes["default"].object,rendering:_propTypes["default"].any};components.set('Home',Home);var DownloadCallout=function DownloadCallout(props){return _react["default"].createElement(_reactNative.View,{testID:"download-callout-mock",__source:{fileName:_jsxFileName,lineNumber:38,columnNumber:5}},props.fields.message?props.fields.message.value:null);};DownloadCallout.propTypes={fields:_propTypes["default"].any};components.set('DownloadCallout',DownloadCallout);components.set('Jumbotron',function(){return _react["default"].createElement(_reactNative.View,{testID:"jumbotron-mock",__source:{fileName:_jsxFileName,lineNumber:47,columnNumber:37}});});return components.get(componentName);};describe('<Placeholder />',function(){var testData=[{label:'Dev data',data:_devData.devData},{label:'LayoutService data - EE off',data:_LSDataEEOff.lsDataEeOff}];testData.forEach(function(dataSet){describe("with ".concat(dataSet.label),function(){test('should render a placeholder with given key',function(){var phData=dataSet.data.sitecore.route.placeholders.main;var component=phData.find(function(c){return c.componentName;});var phKey='page-content';var renderedComponent=_reactTestRenderer["default"].create(_react["default"].createElement(_Placeholder.Placeholder,{name:phKey,rendering:component,componentFactory:componentFactory,__source:{fileName:_jsxFileName,lineNumber:70,columnNumber:13}})).toJSON();expect(renderedComponent).toMatchSnapshot();});test('should render nested placeholders and props correctly',function(){var component=dataSet.data.sitecore.route;var phKey='main';var renderedComponent=_reactTestRenderer["default"].create(_react["default"].createElement(_SitecoreContext.SitecoreContext,{componentFactory:componentFactory,__source:{fileName:_jsxFileName,lineNumber:88,columnNumber:13}},_react["default"].createElement(_Placeholder.Placeholder,{name:phKey,rendering:component,__source:{fileName:_jsxFileName,lineNumber:89,columnNumber:15}}))).toJSON();expect(renderedComponent).toMatchSnapshot();});});});it('should render missing component for unresolved/unknown components',function(){var errorSpy=jest.spyOn(console,'error');errorSpy.mockImplementation(function(){});var Home=function Home(){return _react["default"].createElement(_reactNative.View,{testID:"home-mock",__source:{fileName:_jsxFileName,lineNumber:104,columnNumber:24}});};var factory=function factory(componentName){return componentName==='Home'?Home:null;};var route={placeholders:{main:[{componentName:'Home'},{componentName:'whatisthis'}]}};var phKey='main';var renderedComponent=_reactTestRenderer["default"].create(_react["default"].createElement(_Placeholder.Placeholder,{name:phKey,rendering:route,componentFactory:factory,__source:{fileName:_jsxFileName,lineNumber:124,columnNumber:9}})).toJSON();expect(renderedComponent).toMatchSnapshot();errorSpy.mockRestore();});it('should render null for unknown placeholder',function(){var warnSpy=jest.spyOn(console,'warn');warnSpy.mockImplementation(function(){});var route={name:'',placeholders:{main:[{componentName:'Home'}]}};var phKey='unknown';var renderedComponent=_reactTestRenderer["default"].create(_react["default"].createElement(_Placeholder.Placeholder,{name:phKey,rendering:route,componentFactory:componentFactory,__source:{fileName:_jsxFileName,lineNumber:154,columnNumber:15}})).toJSON();expect(renderedComponent).toMatchSnapshot();expect(warnSpy).toHaveBeenCalledTimes(1);warnSpy.mockRestore();});});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.RichText=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNativeHtmlview=_interopRequireDefault(require("react-native-htmlview"));var _propTypes=_interopRequireDefault(require("prop-types"));var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.RichText=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNativeHtmlview=_interopRequireDefault(require("react-native-htmlview"));var _propTypes=_interopRequireDefault(require("prop-types"));var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/RichText.tsx";var _excluded=["field"];var RichText=exports.RichText=function RichText(_ref){var field=_ref.field,otherProps=(0,_objectWithoutProperties2["default"])(_ref,_excluded);if(!field||!field.editable&&!field.value){return null;}var htmlValue=field.editable?field.editable:field.value;return _react["default"].createElement(_reactNativeHtmlview["default"],(0,_extends2["default"])({value:htmlValue},otherProps,{__source:{fileName:_jsxFileName,lineNumber:21,columnNumber:10}}));};RichText.propTypes={field:_propTypes["default"].shape({value:_propTypes["default"].string,editable:_propTypes["default"].string})};RichText.displayName='RichText';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireDefault(require("react"));var _reactTestRenderer=_interopRequireDefault(require("react-test-renderer"));var _reactNative=require("react-native");var _RichText=require("./RichText");var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireDefault(require("react"));var _reactTestRenderer=_interopRequireDefault(require("react-test-renderer"));var _reactNative=require("react-native");var _RichText=require("./RichText");var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/RichText.test.tsx";describe('<RichText />',function(){test('should render nothing with missing field',function(){var field=null;var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_RichText.RichText,{field:field,__source:{fileName:_jsxFileName,lineNumber:9,columnNumber:38}}));expect(rendered).toMatchSnapshot();});test('should render nothing with missing editable and value',function(){var props={field:{}};var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_RichText.RichText,(0,_extends2["default"])({},props,{__source:{fileName:_jsxFileName,lineNumber:17,columnNumber:38}})));expect(rendered).toMatchSnapshot();});test('should render editable value if present',function(){var props={field:{value:'this value should not be rendered',editable:'<p>this value should be rendered ©</p>'}};var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_RichText.RichText,(0,_extends2["default"])({},props,{__source:{fileName:_jsxFileName,lineNumber:28,columnNumber:38}})));expect(rendered).toMatchSnapshot();});test('should render value if editable is undefined',function(){var props={field:{value:'this value should be rendered',editable:''}};var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_RichText.RichText,(0,_extends2["default"])({},props,{__source:{fileName:_jsxFileName,lineNumber:40,columnNumber:38}})));expect(rendered).toMatchSnapshot();});it('should render other attributes with other props provided',function(){var field={editable:'value with <p>markup</p>'};var rawTextStyles=_reactNative.StyleSheet.create({style:{fontSize:22}});var markupStyles=_reactNative.StyleSheet.create({p:{fontSize:16,marginBottom:10}});var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_RichText.RichText,{field:field,style:{flex:1},stylesheet:markupStyles,textComponentProps:rawTextStyles,__source:{fileName:_jsxFileName,lineNumber:66,columnNumber:7}}));expect(rendered).toMatchSnapshot();});});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.SitecoreContext=exports.ComponentFactoryReactContext=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.SitecoreContext=exports.ComponentFactoryReactContext=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/SitecoreContext.tsx";function _callSuper(t,o,e){return o=(0,_getPrototypeOf2["default"])(o),(0,_possibleConstructorReturn2["default"])(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],(0,_getPrototypeOf2["default"])(t).constructor):o.apply(t,e));}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}var ComponentFactoryReactContext=exports.ComponentFactoryReactContext=_react["default"].createContext({});var SitecoreContext=exports.SitecoreContext=function(_React$Component){function SitecoreContext(props,context){var _this;(0,_classCallCheck2["default"])(this,SitecoreContext);_this=_callSuper(this,SitecoreContext,[props,context]);(0,_defineProperty2["default"])(_this,"componentFactory",void 0);_this.componentFactory=props.componentFactory;return _this;}(0,_inherits2["default"])(SitecoreContext,_React$Component);return(0,_createClass2["default"])(SitecoreContext,[{key:"render",value:function render(){return _react["default"].createElement(ComponentFactoryReactContext.Provider,{value:this.componentFactory,__source:{fileName:_jsxFileName,lineNumber:31,columnNumber:7}},this.props.children);}}]);}(_react["default"].Component);(0,_defineProperty2["default"])(SitecoreContext,"propTypes",{children:_propTypes["default"].any.isRequired,componentFactory:_propTypes["default"].func});(0,_defineProperty2["default"])(SitecoreContext,"displayName",'SitecoreContext');
|
package/dist/components/Text.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Text=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNative=require("react-native");var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Text=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNative=require("react-native");var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/Text.tsx";var _excluded=["field"];var Text=exports.Text=function Text(_ref){var field=_ref.field,otherProps=(0,_objectWithoutProperties2["default"])(_ref,_excluded);if(!field||!field.editable&&(field.value===undefined||field.value==='')){return null;}var textValue=field.editable?field.editable:field.value;return _react["default"].createElement(_reactNative.Text,(0,_extends2["default"])({},otherProps,{__source:{fileName:_jsxFileName,lineNumber:21,columnNumber:10}}),textValue);};Text.propTypes={field:_propTypes["default"].shape({value:_propTypes["default"].any,editable:_propTypes["default"].string})};Text.displayName='Text';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireDefault(require("react"));var _reactTestRenderer=_interopRequireDefault(require("react-test-renderer"));var _Text=require("./Text");var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireDefault(require("react"));var _reactTestRenderer=_interopRequireDefault(require("react-test-renderer"));var _Text=require("./Text");var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/Text.test.tsx";describe('<Text />',function(){test('should render nothing with missing field',function(){var field=null;var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_Text.Text,{field:field,__source:{fileName:_jsxFileName,lineNumber:8,columnNumber:38}}));expect(rendered).toMatchSnapshot();});test('should render nothing with missing editable and value',function(){var props={field:{}};var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_Text.Text,(0,_extends2["default"])({},props,{__source:{fileName:_jsxFileName,lineNumber:16,columnNumber:38}})));expect(rendered).toMatchSnapshot();});it('should render nothing with empty value',function(){var props={field:{value:''}};var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_Text.Text,(0,_extends2["default"])({},props,{__source:{fileName:_jsxFileName,lineNumber:26,columnNumber:38}})));expect(rendered).toMatchSnapshot();});test('should render editable value if present',function(){var props={field:{value:'this value should not be rendered',editable:'this value should be rendered'}};var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_Text.Text,(0,_extends2["default"])({},props,{__source:{fileName:_jsxFileName,lineNumber:37,columnNumber:38}})));expect(rendered).toMatchSnapshot();});test('should render number value',function(){var props={field:{value:1.23}};var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_Text.Text,(0,_extends2["default"])({},props,{__source:{fileName:_jsxFileName,lineNumber:48,columnNumber:38}})));expect(rendered).toMatchSnapshot();});test('should render zero number value',function(){var props={field:{value:0}};var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_Text.Text,(0,_extends2["default"])({},props,{__source:{fileName:_jsxFileName,lineNumber:59,columnNumber:38}})));expect(rendered).toMatchSnapshot();});test('should render value if editable is undefined',function(){var props={field:{value:'this value should be rendered',editable:''}};var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_Text.Text,(0,_extends2["default"])({},props,{__source:{fileName:_jsxFileName,lineNumber:71,columnNumber:38}})));expect(rendered).toMatchSnapshot();});it('should render other attributes with other props provided',function(){var field={editable:'this value should be rendered'};var rendered=_reactTestRenderer["default"].create(_react["default"].createElement(_Text.Text,{field:field,style:{flex:1},selectable:true,__source:{fileName:_jsxFileName,lineNumber:81,columnNumber:38}}));expect(rendered).toMatchSnapshot();});});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.UnrenderableComponent=void 0;var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNative=require("react-native");var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.UnrenderableComponent=void 0;var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNative=require("react-native");var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/components/UnrenderableComponent.tsx";var styles=_reactNative.StyleSheet.create({container:{backgroundColor:'firebrick',padding:10,flex:1},title:{fontSize:22,fontWeight:'bold',marginVertical:20,color:'white'},text:{color:'white',marginVertical:20}});var UnrenderableComponent=exports.UnrenderableComponent=function UnrenderableComponent(props){var componentName=props.rendering&&props.rendering.name?props.rendering.name:'Unnamed Component';return _react["default"].createElement(_reactNative.View,{style:styles.container,__source:{fileName:_jsxFileName,lineNumber:35,columnNumber:5}},_react["default"].createElement(_reactNative.Text,{style:styles.title,__source:{fileName:_jsxFileName,lineNumber:36,columnNumber:7}},componentName),_react["default"].createElement(_reactNative.Text,{style:styles.text,__source:{fileName:_jsxFileName,lineNumber:37,columnNumber:7}},"Component can't be rendered in React Native."));};UnrenderableComponent.propTypes={rendering:_propTypes["default"].shape({componentName:_propTypes["default"].string})};UnrenderableComponent.displayName='UnrenderableComponent';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.withComponentFactory=withComponentFactory;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireDefault(require("react"));var _SitecoreContext=require("../components/SitecoreContext");var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.withComponentFactory=withComponentFactory;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireDefault(require("react"));var _SitecoreContext=require("../components/SitecoreContext");var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/enhancers/withComponentFactory.tsx";function withComponentFactory(Component){return function WithComponentFactory(props){return _react["default"].createElement(_SitecoreContext.ComponentFactoryReactContext.Consumer,{__source:{fileName:_jsxFileName,lineNumber:17,columnNumber:7}},function(context){return _react["default"].createElement(Component,(0,_extends2["default"])({},props,{componentFactory:props.componentFactory||context,__source:{fileName:_jsxFileName,lineNumber:18,columnNumber:23}}));});};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _reactTestRenderer=_interopRequireDefault(require("react-test-renderer"));var _withComponentFactory=require("./withComponentFactory");var _SitecoreContext=require("../components/SitecoreContext");var _jsxFileName="
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _reactTestRenderer=_interopRequireDefault(require("react-test-renderer"));var _withComponentFactory=require("./withComponentFactory");var _SitecoreContext=require("../components/SitecoreContext");var _jsxFileName="/home/vsts/work/1/s/packages/sitecore-jss-react-native/src/enhancers/withComponentFactory.test.tsx";describe('withComponentFactory()',function(){test('should pass factory to wrapped component from context',function(){var components=new Map();components.set('xxx',function(){return _react["default"].createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:12,columnNumber:33}},"I'm component from factory");});var componentFactory=function componentFactory(componentName){return components.get(componentName);};var TestComponent=function TestComponent(props){if(!props.componentFactory)return null;var ComponentFromFactory=props.componentFactory('xxx');return _react["default"].createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:27,columnNumber:9}},_react["default"].createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:28,columnNumber:11}},"Hello world..."),_react["default"].createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:29,columnNumber:11}},"Custom property:",props.customProperty),_react["default"].createElement(ComponentFromFactory,{__source:{fileName:_jsxFileName,lineNumber:30,columnNumber:11}}));};var TestComponentWithFactory=(0,_withComponentFactory.withComponentFactory)(TestComponent);var c=_reactTestRenderer["default"].create(_react["default"].createElement(_SitecoreContext.ComponentFactoryReactContext.Provider,{value:componentFactory,__source:{fileName:_jsxFileName,lineNumber:38,columnNumber:7}},_react["default"].createElement(TestComponentWithFactory,{customProperty:"yyy",__source:{fileName:_jsxFileName,lineNumber:39,columnNumber:9}})));expect(c).toMatchSnapshot();});test('should pass factory to wrapped component from props',function(){var propsFactoryComponents=new Map();var contextFactoryComponents=new Map();contextFactoryComponents.set('xxx',function(){return _react["default"].createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:55,columnNumber:47}},"I'm component from context factory");});propsFactoryComponents.set('xxx',function(){return _react["default"].createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:57,columnNumber:45}},"I'm component from props factory");});var propsComponentFactory=function propsComponentFactory(componentName){return propsFactoryComponents.get(componentName);};var contextComponentFactory=function contextComponentFactory(componentName){return contextFactoryComponents.get(componentName);};var TestComponent=function TestComponent(props){if(!props.componentFactory)return null;var ComponentFromFactory=props.componentFactory('xxx');return _react["default"].createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:70,columnNumber:9}},_react["default"].createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:71,columnNumber:11}},"Hello world..."),_react["default"].createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:72,columnNumber:11}},"Custom property:",props.customProperty),_react["default"].createElement(ComponentFromFactory,{__source:{fileName:_jsxFileName,lineNumber:73,columnNumber:11}}));};var TestComponentWithFactory=(0,_withComponentFactory.withComponentFactory)(TestComponent);var c=_reactTestRenderer["default"].create(_react["default"].createElement(_SitecoreContext.ComponentFactoryReactContext.Provider,{value:contextComponentFactory,__source:{fileName:_jsxFileName,lineNumber:81,columnNumber:7}},_react["default"].createElement(TestComponentWithFactory,{componentFactory:propsComponentFactory,customProperty:"yyy",__source:{fileName:_jsxFileName,lineNumber:82,columnNumber:9}})));expect(c).toMatchSnapshot();});});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-jss/sitecore-jss-react-native",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.5.0-beta.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"url": "https://github.com/sitecore/jss/issues"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@sitecore-jss/sitecore-jss": "22.
|
|
30
|
+
"@sitecore-jss/sitecore-jss": "^22.5.0-beta.2",
|
|
31
31
|
"prop-types": "^15.7.2",
|
|
32
32
|
"react-native-htmlview": "^0.15.0",
|
|
33
33
|
"react-native-svg": "^5.3.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"types": "./types/index.d.ts",
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "19bc177221b5f573321c8906c0d7abd384550281",
|
|
77
77
|
"files": [
|
|
78
78
|
"dist"
|
|
79
79
|
]
|