@mjhls/mjh-framework 1.0.863-author-details-v2 → 1.0.863-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/dist/cjs/AD.js +9 -10
  2. package/dist/cjs/AD300x250.js +9 -10
  3. package/dist/cjs/AD300x250x600.js +9 -10
  4. package/dist/cjs/AD728x90.js +10 -11
  5. package/dist/cjs/ADFloatingFooter.js +11 -12
  6. package/dist/cjs/ADFooter.js +8 -9
  7. package/dist/cjs/ADGutter.js +11 -12
  8. package/dist/cjs/{ADInfeed-25d48cc2.js → ADInfeed-98c71bcd.js} +9 -11
  9. package/dist/cjs/ADSkyscraper.js +11 -12
  10. package/dist/cjs/ADSponsoredResources.js +11 -12
  11. package/dist/cjs/ADWebcast.js +11 -12
  12. package/dist/cjs/ADWelcome.js +15 -16
  13. package/dist/cjs/{ADlgInfeed-a535a768.js → ADlgInfeed-9de32585.js} +6 -7
  14. package/dist/cjs/AccordionPanel.js +22 -24
  15. package/dist/cjs/AdSlot.js +13 -14
  16. package/dist/cjs/AdSlotsProvider.js +902 -11
  17. package/dist/cjs/AlgoliaSearch.js +842 -952
  18. package/dist/cjs/AlphabeticList.js +15 -16
  19. package/dist/cjs/ArticleCarousel.js +10 -11
  20. package/dist/cjs/ArticleProgramLandingPage.js +27 -28
  21. package/dist/cjs/ArticleSeriesLandingPage.js +22 -23
  22. package/dist/cjs/ArticleSeriesListing.js +39 -40
  23. package/dist/cjs/Auth.js +1198 -238
  24. package/dist/cjs/AuthWrapper.js +38 -119
  25. package/dist/cjs/{AuthorComponent-ac8972ce.js → AuthorComponent-bb831b74.js} +12 -13
  26. package/dist/cjs/{BlockContent-8b494587.js → BlockContent-091a991f.js} +24 -25
  27. package/dist/cjs/Breadcrumbs.js +21 -23
  28. package/dist/cjs/CMEDeck.js +64 -64
  29. package/dist/cjs/Column1.js +11 -14
  30. package/dist/cjs/Column2.js +19 -22
  31. package/dist/cjs/Column3.js +32 -35
  32. package/dist/cjs/ConferenceArticleCard.js +17 -18
  33. package/dist/cjs/ConferenceBanner-4a16fddc.js +23 -0
  34. package/dist/cjs/DeckContent.js +72 -76
  35. package/dist/cjs/DeckQueue.js +68 -72
  36. package/dist/cjs/{Dfp-391fd124.js → Dfp-26baccf1.js} +22 -23
  37. package/dist/cjs/EventsDeck.js +116 -123
  38. package/dist/cjs/ExternalResources.js +46 -47
  39. package/dist/cjs/Feature.js +23 -25
  40. package/dist/cjs/ForbesHero.js +34 -35
  41. package/dist/cjs/GridContent.js +203 -208
  42. package/dist/cjs/GridHero.js +35 -36
  43. package/dist/cjs/GroupDeck.js +48 -49
  44. package/dist/cjs/HamMagazine.js +116 -121
  45. package/dist/cjs/Header.js +12 -14
  46. package/dist/cjs/Hero.js +9 -10
  47. package/dist/cjs/HighlightenVideo.js +16 -17
  48. package/dist/cjs/HorizontalArticleListing.js +36 -37
  49. package/dist/cjs/HorizontalHero.js +23 -24
  50. package/dist/cjs/IssueContentDeck.js +65 -70
  51. package/dist/cjs/IssueDeck.js +60 -65
  52. package/dist/cjs/IssueLanding.js +28 -29
  53. package/dist/cjs/LeftNav.js +20 -22
  54. package/dist/cjs/MasterDeck.js +49 -50
  55. package/dist/cjs/MediaSeriesLanding.js +786 -733
  56. package/dist/cjs/NavDvm.js +63 -68
  57. package/dist/cjs/{NavFooter-3dcd99a8.js → NavFooter-76c913e3.js} +14 -15
  58. package/dist/cjs/NavMagazine.js +116 -121
  59. package/dist/cjs/NavNative.js +108 -116
  60. package/dist/cjs/OncliveHero.js +17 -17
  61. package/dist/cjs/OncliveLargeHero.js +63 -64
  62. package/dist/cjs/PageFilter.js +8 -9
  63. package/dist/cjs/PartnerDetailListing.js +1242 -139
  64. package/dist/cjs/PdfDownload.js +8 -9
  65. package/dist/cjs/PopUpModal.js +13 -15
  66. package/dist/cjs/PubSection.js +19 -20
  67. package/dist/cjs/PubToc.js +7 -8
  68. package/dist/cjs/PublicationDeck.js +59 -64
  69. package/dist/cjs/PublicationLanding.js +83 -87
  70. package/dist/cjs/QueueDeckExpanded.js +285 -285
  71. package/dist/cjs/RecentNews.js +19 -20
  72. package/dist/cjs/RelatedContent.js +22 -23
  73. package/dist/cjs/RelatedTopicsDropdown.js +19 -22
  74. package/dist/cjs/RolesDeck.js +27 -32
  75. package/dist/cjs/Search.js +12 -16
  76. package/dist/cjs/SeriesListingDeck.js +26 -26
  77. package/dist/cjs/{SeriesSlider-0d3bf265.js → SeriesSlider-8bbc989f.js} +33 -34
  78. package/dist/cjs/SideFooter.js +23 -24
  79. package/dist/cjs/SocialIcons.js +9 -10
  80. package/dist/cjs/{SocialSearchComponent-19548e2a.js → SocialSearchComponent-cea213aa.js} +34 -38
  81. package/dist/cjs/SocialShare.js +29 -31
  82. package/dist/cjs/TaxonomyCard.js +54 -59
  83. package/dist/cjs/TaxonomyDescription.js +21 -22
  84. package/dist/cjs/TemplateNormal.js +34 -35
  85. package/dist/cjs/ThumbnailCard.js +17 -19
  86. package/dist/cjs/Ustream.js +21 -22
  87. package/dist/cjs/VerticalHero.js +15 -16
  88. package/dist/cjs/VideoProgramLandingPage.js +43 -47
  89. package/dist/cjs/VideoSeriesCard.js +22 -23
  90. package/dist/cjs/VideoSeriesFilter.js +9 -9
  91. package/dist/cjs/VideoSeriesLandingPage.js +27 -28
  92. package/dist/cjs/VideoSeriesListing.js +56 -57
  93. package/dist/cjs/View.js +203 -209
  94. package/dist/cjs/YahooHero.js +30 -31
  95. package/dist/cjs/YoutubeGroup.js +50 -51
  96. package/dist/cjs/{brightcove-react-player-loader.es-5c98aec7.js → brightcove-react-player-loader.es-156bd4d6.js} +8 -10
  97. package/dist/cjs/faundadb.js +16 -16
  98. package/dist/cjs/getRelatedArticle.js +5 -354
  99. package/dist/cjs/getRootDocGroup.js +3 -3
  100. package/dist/cjs/getSerializers.js +11 -11
  101. package/dist/cjs/{getTargeting-a9a871f0.js → getTargeting-f1821260.js} +2 -2
  102. package/dist/cjs/getTargeting.js +1 -1
  103. package/dist/cjs/iconBase-68959171.js +3 -0
  104. package/dist/cjs/{index-6367b7bf.js → index-3294d3bc.js} +17 -16
  105. package/dist/cjs/{index-9d365128.js → index-96b3db50.js} +10 -12
  106. package/dist/cjs/{index-2cf30c83.js → index-98e01cb9.js} +8 -9
  107. package/dist/cjs/{index-04a5a4a2.js → index-a1e54356.js} +934 -961
  108. package/dist/cjs/{index-b5eb3ff8.js → index-be0c82be.js} +19 -20
  109. package/dist/cjs/{index.es-f3e47207.js → index.es-9110add6.js} +12 -31
  110. package/dist/cjs/{index.esm-3ffa049c.js → index.esm-4d410430.js} +20 -20
  111. package/dist/cjs/{index.esm-974f47d9.js → index.esm-90433435.js} +15 -6
  112. package/dist/cjs/{index.esm-44f3e2d0.js → index.esm-e32d3e8e.js} +6 -3
  113. package/dist/cjs/{index.esm-05850a2f.js → index.esm-ff47db6f.js} +12 -5
  114. package/dist/cjs/index.js +62 -66
  115. package/dist/cjs/{inherits-0c7830c5.js → inherits-1f5a1c72.js} +3 -3
  116. package/dist/cjs/inherits-8d29278d.js +110 -0
  117. package/dist/cjs/{lodash-7fd85bcf.js → lodash-fc2922d0.js} +22 -71
  118. package/dist/cjs/{main-7b5e57b0.js → main-02daeefe.js} +54 -90
  119. package/dist/cjs/{md5-e1ca5797.js → md5-5039b1a6.js} +1 -1
  120. package/dist/cjs/{moment-ca3bd9fb.js → moment-575fe24c.js} +8 -10
  121. package/dist/cjs/{react-social-icons-07939b41.js → react-social-icons-f7f48f71.js} +11 -12
  122. package/dist/cjs/timeDifferenceCalc.js +1 -1
  123. package/dist/cjs/{typeof-9d7f610f.js → typeof-725500bc.js} +1 -1
  124. package/dist/cjs/urlFor.js +3 -3
  125. package/dist/cjs/{visibility-sensor-eb2c5b69.js → visibility-sensor-ad5e3116.js} +5 -7
  126. package/dist/esm/AD.js +7 -7
  127. package/dist/esm/AD300x250.js +7 -7
  128. package/dist/esm/AD300x250x600.js +7 -7
  129. package/dist/esm/AD728x90.js +8 -8
  130. package/dist/esm/ADFloatingFooter.js +9 -9
  131. package/dist/esm/ADFooter.js +6 -6
  132. package/dist/esm/ADGutter.js +9 -9
  133. package/dist/esm/{ADInfeed-56a3db8b.js → ADInfeed-1cc9d817.js} +7 -7
  134. package/dist/esm/ADSkyscraper.js +9 -9
  135. package/dist/esm/ADSponsoredResources.js +9 -9
  136. package/dist/esm/ADWebcast.js +9 -9
  137. package/dist/esm/ADWelcome.js +13 -13
  138. package/dist/esm/{ADlgInfeed-53edb995.js → ADlgInfeed-8c4f129e.js} +4 -4
  139. package/dist/esm/AccordionPanel.js +17 -17
  140. package/dist/esm/AdSlot.js +5 -5
  141. package/dist/esm/AdSlotsProvider.js +902 -10
  142. package/dist/esm/AlgoliaSearch.js +238 -347
  143. package/dist/esm/AlphabeticList.js +13 -13
  144. package/dist/esm/ArticleCarousel.js +8 -8
  145. package/dist/esm/ArticleProgramLandingPage.js +20 -20
  146. package/dist/esm/ArticleSeriesLandingPage.js +17 -17
  147. package/dist/esm/ArticleSeriesListing.js +36 -36
  148. package/dist/esm/Auth.js +1186 -222
  149. package/dist/esm/AuthWrapper.js +36 -116
  150. package/dist/esm/{AuthorComponent-8ffd4679.js → AuthorComponent-34b16174.js} +10 -10
  151. package/dist/esm/{BlockContent-d05b5b23.js → BlockContent-e9b4ddcf.js} +4 -4
  152. package/dist/esm/Breadcrumbs.js +11 -11
  153. package/dist/esm/CMEDeck.js +61 -61
  154. package/dist/esm/Column1.js +9 -9
  155. package/dist/esm/Column2.js +17 -17
  156. package/dist/esm/Column3.js +30 -30
  157. package/dist/esm/ConferenceArticleCard.js +15 -15
  158. package/dist/esm/{ConferenceBanner-9162d0ca.js → ConferenceBanner-8792ebd2.js} +4 -4
  159. package/dist/esm/DeckContent.js +68 -68
  160. package/dist/esm/DeckQueue.js +64 -64
  161. package/dist/esm/{Dfp-2f9796e1.js → Dfp-b7236041.js} +10 -10
  162. package/dist/esm/EventsDeck.js +92 -92
  163. package/dist/esm/ExternalResources.js +41 -41
  164. package/dist/esm/Feature.js +17 -17
  165. package/dist/esm/ForbesHero.js +28 -28
  166. package/dist/esm/GridContent.js +172 -172
  167. package/dist/esm/GridHero.js +29 -29
  168. package/dist/esm/GroupDeck.js +36 -36
  169. package/dist/esm/HamMagazine.js +91 -91
  170. package/dist/esm/Header.js +8 -8
  171. package/dist/esm/Hero.js +7 -7
  172. package/dist/esm/HighlightenVideo.js +14 -14
  173. package/dist/esm/HorizontalArticleListing.js +34 -34
  174. package/dist/esm/HorizontalHero.js +21 -21
  175. package/dist/esm/IssueContentDeck.js +53 -53
  176. package/dist/esm/IssueDeck.js +54 -54
  177. package/dist/esm/IssueLanding.js +26 -26
  178. package/dist/esm/LeftNav.js +16 -16
  179. package/dist/esm/MasterDeck.js +46 -46
  180. package/dist/esm/MediaSeriesLanding.js +506 -450
  181. package/dist/esm/NavDvm.js +46 -46
  182. package/dist/esm/{NavFooter-c29526b7.js → NavFooter-e27bd93b.js} +12 -12
  183. package/dist/esm/NavMagazine.js +93 -93
  184. package/dist/esm/NavNative.js +83 -83
  185. package/dist/esm/OncliveHero.js +15 -14
  186. package/dist/esm/OncliveLargeHero.js +52 -52
  187. package/dist/esm/PageFilter.js +6 -6
  188. package/dist/esm/PartnerDetailListing.js +1240 -136
  189. package/dist/esm/PdfDownload.js +6 -6
  190. package/dist/esm/PopUpModal.js +8 -8
  191. package/dist/esm/PubSection.js +17 -17
  192. package/dist/esm/PubToc.js +5 -5
  193. package/dist/esm/PublicationDeck.js +51 -51
  194. package/dist/esm/PublicationLanding.js +69 -69
  195. package/dist/esm/QueueDeckExpanded.js +251 -251
  196. package/dist/esm/RecentNews.js +17 -17
  197. package/dist/esm/RelatedContent.js +17 -17
  198. package/dist/esm/RelatedTopicsDropdown.js +11 -11
  199. package/dist/esm/RolesDeck.js +25 -25
  200. package/dist/esm/Search.js +7 -7
  201. package/dist/esm/SeriesListingDeck.js +20 -20
  202. package/dist/esm/{SeriesSlider-7d89f4d9.js → SeriesSlider-a866bb21.js} +24 -24
  203. package/dist/esm/SideFooter.js +19 -19
  204. package/dist/esm/SocialIcons.js +7 -7
  205. package/dist/esm/{SocialSearchComponent-47815365.js → SocialSearchComponent-03c3e869.js} +28 -28
  206. package/dist/esm/SocialShare.js +25 -25
  207. package/dist/esm/TaxonomyCard.js +50 -50
  208. package/dist/esm/TaxonomyDescription.js +16 -16
  209. package/dist/esm/TemplateNormal.js +31 -31
  210. package/dist/esm/ThumbnailCard.js +10 -10
  211. package/dist/esm/Ustream.js +18 -18
  212. package/dist/esm/VerticalHero.js +13 -13
  213. package/dist/esm/VideoProgramLandingPage.js +32 -32
  214. package/dist/esm/VideoSeriesCard.js +17 -17
  215. package/dist/esm/VideoSeriesFilter.js +6 -6
  216. package/dist/esm/VideoSeriesLandingPage.js +17 -17
  217. package/dist/esm/VideoSeriesListing.js +53 -53
  218. package/dist/esm/View.js +184 -186
  219. package/dist/esm/YahooHero.js +25 -25
  220. package/dist/esm/YoutubeGroup.js +35 -35
  221. package/dist/esm/{brightcove-react-player-loader.es-4abff0b1.js → brightcove-react-player-loader.es-83f53e4e.js} +6 -7
  222. package/dist/esm/faundadb.js +1 -1
  223. package/dist/esm/getRelatedArticle.js +5 -354
  224. package/dist/esm/getSerializers.js +11 -11
  225. package/dist/esm/{index-f7fb1e25.js → index-41a678ea.js} +3 -3
  226. package/dist/esm/{index-6c12bdd5.js → index-5f7e79e7.js} +4 -4
  227. package/dist/esm/{index-51a80699.js → index-73819142.js} +19 -20
  228. package/dist/esm/{index-cf54da7f.js → index-a1c5f00a.js} +887 -904
  229. package/dist/esm/{index-c00b0bbb.js → index-ef6d5dcf.js} +17 -16
  230. package/dist/esm/{index.es-c6222053.js → index.es-29c1cef5.js} +10 -28
  231. package/dist/esm/{index.esm-3fdda599.js → index.esm-29e48d38.js} +15 -6
  232. package/dist/esm/{index.esm-a8ff922c.js → index.esm-cf08bf18.js} +12 -5
  233. package/dist/esm/{index.esm-c6715e80.js → index.esm-f8aaeeeb.js} +6 -3
  234. package/dist/esm/{index.esm-8ee5ff72.js → index.esm-fd746768.js} +18 -17
  235. package/dist/esm/index.js +52 -53
  236. package/dist/esm/inherits-77d5e4fc.js +101 -0
  237. package/dist/esm/{inherits-75d45541.js → inherits-cf8dde54.js} +1 -1
  238. package/dist/esm/{lodash-ec8c6b48.js → lodash-17fdfebb.js} +22 -71
  239. package/dist/esm/{main-747e7d25.js → main-e4a934b2.js} +52 -87
  240. package/dist/esm/{md5-4e42248e.js → md5-9be0e905.js} +1 -1
  241. package/dist/esm/{moment-b6f49411.js → moment-e2f9b20c.js} +8 -10
  242. package/dist/esm/{react-social-icons-3822f1ce.js → react-social-icons-a7d5c5c7.js} +5 -5
  243. package/dist/esm/timeDifferenceCalc.js +1 -1
  244. package/dist/esm/{typeof-af9c50d8.js → typeof-6435ba1c.js} +1 -1
  245. package/dist/esm/urlFor.js +1 -1
  246. package/dist/esm/{visibility-sensor-f40c2564.js → visibility-sensor-72fd8f8b.js} +2 -2
  247. package/package.json +2 -2
  248. package/dist/cjs/ConferenceBanner-6c9e718a.js +0 -24
  249. package/dist/cjs/index-bd6c9f56.js +0 -211
  250. package/dist/esm/index-db3bb315.js +0 -207
@@ -1,211 +0,0 @@
1
- 'use strict';
2
-
3
- /*!
4
- * cookie
5
- * Copyright(c) 2012-2014 Roman Shtylman
6
- * Copyright(c) 2015 Douglas Christopher Wilson
7
- * MIT Licensed
8
- */
9
-
10
- /**
11
- * Module exports.
12
- * @public
13
- */
14
-
15
- var parse_1 = parse;
16
- var serialize_1 = serialize;
17
-
18
- /**
19
- * Module variables.
20
- * @private
21
- */
22
-
23
- var decode = decodeURIComponent;
24
- var encode = encodeURIComponent;
25
- var pairSplitRegExp = /; */;
26
-
27
- /**
28
- * RegExp to match field-content in RFC 7230 sec 3.2
29
- *
30
- * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
31
- * field-vchar = VCHAR / obs-text
32
- * obs-text = %x80-FF
33
- */
34
-
35
- var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
36
-
37
- /**
38
- * Parse a cookie header.
39
- *
40
- * Parse the given cookie header string into an object
41
- * The object has the various cookies as keys(names) => values
42
- *
43
- * @param {string} str
44
- * @param {object} [options]
45
- * @return {object}
46
- * @public
47
- */
48
-
49
- function parse(str, options) {
50
- if (typeof str !== 'string') {
51
- throw new TypeError('argument str must be a string');
52
- }
53
-
54
- var obj = {};
55
- var opt = options || {};
56
- var pairs = str.split(pairSplitRegExp);
57
- var dec = opt.decode || decode;
58
-
59
- for (var i = 0; i < pairs.length; i++) {
60
- var pair = pairs[i];
61
- var eq_idx = pair.indexOf('=');
62
-
63
- // skip things that don't look like key=value
64
- if (eq_idx < 0) {
65
- continue;
66
- }
67
-
68
- var key = pair.substr(0, eq_idx).trim();
69
- var val = pair.substr(++eq_idx, pair.length).trim();
70
-
71
- // quoted values
72
- if ('"' == val[0]) {
73
- val = val.slice(1, -1);
74
- }
75
-
76
- // only assign once
77
- if (undefined == obj[key]) {
78
- obj[key] = tryDecode(val, dec);
79
- }
80
- }
81
-
82
- return obj;
83
- }
84
-
85
- /**
86
- * Serialize data into a cookie header.
87
- *
88
- * Serialize the a name value pair into a cookie string suitable for
89
- * http headers. An optional options object specified cookie parameters.
90
- *
91
- * serialize('foo', 'bar', { httpOnly: true })
92
- * => "foo=bar; httpOnly"
93
- *
94
- * @param {string} name
95
- * @param {string} val
96
- * @param {object} [options]
97
- * @return {string}
98
- * @public
99
- */
100
-
101
- function serialize(name, val, options) {
102
- var opt = options || {};
103
- var enc = opt.encode || encode;
104
-
105
- if (typeof enc !== 'function') {
106
- throw new TypeError('option encode is invalid');
107
- }
108
-
109
- if (!fieldContentRegExp.test(name)) {
110
- throw new TypeError('argument name is invalid');
111
- }
112
-
113
- var value = enc(val);
114
-
115
- if (value && !fieldContentRegExp.test(value)) {
116
- throw new TypeError('argument val is invalid');
117
- }
118
-
119
- var str = name + '=' + value;
120
-
121
- if (null != opt.maxAge) {
122
- var maxAge = opt.maxAge - 0;
123
-
124
- if (isNaN(maxAge) || !isFinite(maxAge)) {
125
- throw new TypeError('option maxAge is invalid')
126
- }
127
-
128
- str += '; Max-Age=' + Math.floor(maxAge);
129
- }
130
-
131
- if (opt.domain) {
132
- if (!fieldContentRegExp.test(opt.domain)) {
133
- throw new TypeError('option domain is invalid');
134
- }
135
-
136
- str += '; Domain=' + opt.domain;
137
- }
138
-
139
- if (opt.path) {
140
- if (!fieldContentRegExp.test(opt.path)) {
141
- throw new TypeError('option path is invalid');
142
- }
143
-
144
- str += '; Path=' + opt.path;
145
- }
146
-
147
- if (opt.expires) {
148
- if (typeof opt.expires.toUTCString !== 'function') {
149
- throw new TypeError('option expires is invalid');
150
- }
151
-
152
- str += '; Expires=' + opt.expires.toUTCString();
153
- }
154
-
155
- if (opt.httpOnly) {
156
- str += '; HttpOnly';
157
- }
158
-
159
- if (opt.secure) {
160
- str += '; Secure';
161
- }
162
-
163
- if (opt.sameSite) {
164
- var sameSite = typeof opt.sameSite === 'string'
165
- ? opt.sameSite.toLowerCase() : opt.sameSite;
166
-
167
- switch (sameSite) {
168
- case true:
169
- str += '; SameSite=Strict';
170
- break;
171
- case 'lax':
172
- str += '; SameSite=Lax';
173
- break;
174
- case 'strict':
175
- str += '; SameSite=Strict';
176
- break;
177
- case 'none':
178
- str += '; SameSite=None';
179
- break;
180
- default:
181
- throw new TypeError('option sameSite is invalid');
182
- }
183
- }
184
-
185
- return str;
186
- }
187
-
188
- /**
189
- * Try decoding a string using a decoding function.
190
- *
191
- * @param {string} str
192
- * @param {function} decode
193
- * @private
194
- */
195
-
196
- function tryDecode(str, decode) {
197
- try {
198
- return decode(str);
199
- } catch (e) {
200
- return str;
201
- }
202
- }
203
-
204
- var cookie = {
205
- parse: parse_1,
206
- serialize: serialize_1
207
- };
208
-
209
- exports.cookie = cookie;
210
- exports.parse_1 = parse_1;
211
- exports.serialize_1 = serialize_1;
@@ -1,207 +0,0 @@
1
- /*!
2
- * cookie
3
- * Copyright(c) 2012-2014 Roman Shtylman
4
- * Copyright(c) 2015 Douglas Christopher Wilson
5
- * MIT Licensed
6
- */
7
-
8
- /**
9
- * Module exports.
10
- * @public
11
- */
12
-
13
- var parse_1 = parse;
14
- var serialize_1 = serialize;
15
-
16
- /**
17
- * Module variables.
18
- * @private
19
- */
20
-
21
- var decode = decodeURIComponent;
22
- var encode = encodeURIComponent;
23
- var pairSplitRegExp = /; */;
24
-
25
- /**
26
- * RegExp to match field-content in RFC 7230 sec 3.2
27
- *
28
- * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
29
- * field-vchar = VCHAR / obs-text
30
- * obs-text = %x80-FF
31
- */
32
-
33
- var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
34
-
35
- /**
36
- * Parse a cookie header.
37
- *
38
- * Parse the given cookie header string into an object
39
- * The object has the various cookies as keys(names) => values
40
- *
41
- * @param {string} str
42
- * @param {object} [options]
43
- * @return {object}
44
- * @public
45
- */
46
-
47
- function parse(str, options) {
48
- if (typeof str !== 'string') {
49
- throw new TypeError('argument str must be a string');
50
- }
51
-
52
- var obj = {};
53
- var opt = options || {};
54
- var pairs = str.split(pairSplitRegExp);
55
- var dec = opt.decode || decode;
56
-
57
- for (var i = 0; i < pairs.length; i++) {
58
- var pair = pairs[i];
59
- var eq_idx = pair.indexOf('=');
60
-
61
- // skip things that don't look like key=value
62
- if (eq_idx < 0) {
63
- continue;
64
- }
65
-
66
- var key = pair.substr(0, eq_idx).trim();
67
- var val = pair.substr(++eq_idx, pair.length).trim();
68
-
69
- // quoted values
70
- if ('"' == val[0]) {
71
- val = val.slice(1, -1);
72
- }
73
-
74
- // only assign once
75
- if (undefined == obj[key]) {
76
- obj[key] = tryDecode(val, dec);
77
- }
78
- }
79
-
80
- return obj;
81
- }
82
-
83
- /**
84
- * Serialize data into a cookie header.
85
- *
86
- * Serialize the a name value pair into a cookie string suitable for
87
- * http headers. An optional options object specified cookie parameters.
88
- *
89
- * serialize('foo', 'bar', { httpOnly: true })
90
- * => "foo=bar; httpOnly"
91
- *
92
- * @param {string} name
93
- * @param {string} val
94
- * @param {object} [options]
95
- * @return {string}
96
- * @public
97
- */
98
-
99
- function serialize(name, val, options) {
100
- var opt = options || {};
101
- var enc = opt.encode || encode;
102
-
103
- if (typeof enc !== 'function') {
104
- throw new TypeError('option encode is invalid');
105
- }
106
-
107
- if (!fieldContentRegExp.test(name)) {
108
- throw new TypeError('argument name is invalid');
109
- }
110
-
111
- var value = enc(val);
112
-
113
- if (value && !fieldContentRegExp.test(value)) {
114
- throw new TypeError('argument val is invalid');
115
- }
116
-
117
- var str = name + '=' + value;
118
-
119
- if (null != opt.maxAge) {
120
- var maxAge = opt.maxAge - 0;
121
-
122
- if (isNaN(maxAge) || !isFinite(maxAge)) {
123
- throw new TypeError('option maxAge is invalid')
124
- }
125
-
126
- str += '; Max-Age=' + Math.floor(maxAge);
127
- }
128
-
129
- if (opt.domain) {
130
- if (!fieldContentRegExp.test(opt.domain)) {
131
- throw new TypeError('option domain is invalid');
132
- }
133
-
134
- str += '; Domain=' + opt.domain;
135
- }
136
-
137
- if (opt.path) {
138
- if (!fieldContentRegExp.test(opt.path)) {
139
- throw new TypeError('option path is invalid');
140
- }
141
-
142
- str += '; Path=' + opt.path;
143
- }
144
-
145
- if (opt.expires) {
146
- if (typeof opt.expires.toUTCString !== 'function') {
147
- throw new TypeError('option expires is invalid');
148
- }
149
-
150
- str += '; Expires=' + opt.expires.toUTCString();
151
- }
152
-
153
- if (opt.httpOnly) {
154
- str += '; HttpOnly';
155
- }
156
-
157
- if (opt.secure) {
158
- str += '; Secure';
159
- }
160
-
161
- if (opt.sameSite) {
162
- var sameSite = typeof opt.sameSite === 'string'
163
- ? opt.sameSite.toLowerCase() : opt.sameSite;
164
-
165
- switch (sameSite) {
166
- case true:
167
- str += '; SameSite=Strict';
168
- break;
169
- case 'lax':
170
- str += '; SameSite=Lax';
171
- break;
172
- case 'strict':
173
- str += '; SameSite=Strict';
174
- break;
175
- case 'none':
176
- str += '; SameSite=None';
177
- break;
178
- default:
179
- throw new TypeError('option sameSite is invalid');
180
- }
181
- }
182
-
183
- return str;
184
- }
185
-
186
- /**
187
- * Try decoding a string using a decoding function.
188
- *
189
- * @param {string} str
190
- * @param {function} decode
191
- * @private
192
- */
193
-
194
- function tryDecode(str, decode) {
195
- try {
196
- return decode(str);
197
- } catch (e) {
198
- return str;
199
- }
200
- }
201
-
202
- var cookie = {
203
- parse: parse_1,
204
- serialize: serialize_1
205
- };
206
-
207
- export { cookie as c, parse_1 as p, serialize_1 as s };