jclic 2.1.21 → 2.1.23

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 (175) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/jclic-node.js +9 -8
  3. package/dist/jclic-node.js.map +1 -1
  4. package/dist/jclic.min.js +2 -2
  5. package/dist/jclic.min.js.map +1 -1
  6. package/package.json +4 -4
  7. package/src/GlobalData.js +1 -1
  8. package/src/JClicPlayer.js +2 -2
  9. package/src/bags/MediaBag.js +6 -5
  10. package/dist/1078.jclic-node.js +0 -282
  11. package/dist/1078.jclic-node.js.map +0 -1
  12. package/dist/1196.jclic-node.js +0 -808
  13. package/dist/1196.jclic-node.js.map +0 -1
  14. package/dist/1253.jclic-node.js +0 -1432
  15. package/dist/1253.jclic-node.js.map +0 -1
  16. package/dist/13.jclic-node.js +0 -103
  17. package/dist/13.jclic-node.js.map +0 -1
  18. package/dist/1567.jclic-node.js +0 -2313
  19. package/dist/1567.jclic-node.js.map +0 -1
  20. package/dist/1588.jclic-node.js +0 -602
  21. package/dist/1588.jclic-node.js.map +0 -1
  22. package/dist/1725.jclic-node.js +0 -836
  23. package/dist/1725.jclic-node.js.map +0 -1
  24. package/dist/1731.jclic-node.js +0 -438
  25. package/dist/1731.jclic-node.js.map +0 -1
  26. package/dist/1842.jclic-node.js +0 -651
  27. package/dist/1842.jclic-node.js.map +0 -1
  28. package/dist/2160.jclic-node.js +0 -1016
  29. package/dist/2160.jclic-node.js.map +0 -1
  30. package/dist/222.jclic-node.js +0 -129
  31. package/dist/222.jclic-node.js.map +0 -1
  32. package/dist/2316.jclic-node.js +0 -949
  33. package/dist/2316.jclic-node.js.map +0 -1
  34. package/dist/2355.jclic-node.js +0 -371
  35. package/dist/2355.jclic-node.js.map +0 -1
  36. package/dist/2366.jclic-node.js +0 -431
  37. package/dist/2366.jclic-node.js.map +0 -1
  38. package/dist/2379.jclic-node.js +0 -202
  39. package/dist/2379.jclic-node.js.map +0 -1
  40. package/dist/2437.jclic-node.js +0 -450
  41. package/dist/2437.jclic-node.js.map +0 -1
  42. package/dist/2531.jclic-node.js +0 -869
  43. package/dist/2531.jclic-node.js.map +0 -1
  44. package/dist/2608.jclic-node.js +0 -160
  45. package/dist/2608.jclic-node.js.map +0 -1
  46. package/dist/2715.jclic-node.js +0 -554
  47. package/dist/2715.jclic-node.js.map +0 -1
  48. package/dist/277.jclic-node.js +0 -22
  49. package/dist/277.jclic-node.js.map +0 -1
  50. package/dist/2921.jclic-node.js +0 -660
  51. package/dist/2921.jclic-node.js.map +0 -1
  52. package/dist/2952.jclic-node.js +0 -101
  53. package/dist/2952.jclic-node.js.map +0 -1
  54. package/dist/3018.jclic-node.js +0 -421
  55. package/dist/3018.jclic-node.js.map +0 -1
  56. package/dist/3019.jclic-node.js +0 -682
  57. package/dist/3019.jclic-node.js.map +0 -1
  58. package/dist/3231.jclic-node.js +0 -274
  59. package/dist/3231.jclic-node.js.map +0 -1
  60. package/dist/331.jclic-node.js +0 -115
  61. package/dist/331.jclic-node.js.map +0 -1
  62. package/dist/3391.jclic-node.js +0 -276
  63. package/dist/3391.jclic-node.js.map +0 -1
  64. package/dist/3502.jclic-node.js +0 -671
  65. package/dist/3502.jclic-node.js.map +0 -1
  66. package/dist/3653.jclic-node.js +0 -982
  67. package/dist/3653.jclic-node.js.map +0 -1
  68. package/dist/371.jclic.min.js +0 -2
  69. package/dist/371.jclic.min.js.map +0 -1
  70. package/dist/3856.jclic-node.js +0 -575
  71. package/dist/3856.jclic-node.js.map +0 -1
  72. package/dist/4112.jclic-node.js +0 -659
  73. package/dist/4112.jclic-node.js.map +0 -1
  74. package/dist/4123.jclic-node.js +0 -910
  75. package/dist/4123.jclic-node.js.map +0 -1
  76. package/dist/427.jclic-node.js +0 -894
  77. package/dist/427.jclic-node.js.map +0 -1
  78. package/dist/4483.jclic-node.js +0 -327
  79. package/dist/4483.jclic-node.js.map +0 -1
  80. package/dist/4548.jclic-node.js +0 -1078
  81. package/dist/4548.jclic-node.js.map +0 -1
  82. package/dist/466.jclic-node.js +0 -99
  83. package/dist/466.jclic-node.js.map +0 -1
  84. package/dist/485.jclic-node.js +0 -783
  85. package/dist/485.jclic-node.js.map +0 -1
  86. package/dist/4921.jclic-node.js +0 -500
  87. package/dist/4921.jclic-node.js.map +0 -1
  88. package/dist/5091.jclic-node.js +0 -239
  89. package/dist/5091.jclic-node.js.map +0 -1
  90. package/dist/520.jclic-node.js +0 -550
  91. package/dist/520.jclic-node.js.map +0 -1
  92. package/dist/5312.jclic-node.js +0 -1126
  93. package/dist/5312.jclic-node.js.map +0 -1
  94. package/dist/5338.jclic-node.js +0 -212
  95. package/dist/5338.jclic-node.js.map +0 -1
  96. package/dist/5344.jclic-node.js +0 -229
  97. package/dist/5344.jclic-node.js.map +0 -1
  98. package/dist/5550.jclic-node.js +0 -238
  99. package/dist/5550.jclic-node.js.map +0 -1
  100. package/dist/5626.jclic-node.js +0 -614
  101. package/dist/5626.jclic-node.js.map +0 -1
  102. package/dist/5977.jclic-node.js +0 -1081
  103. package/dist/5977.jclic-node.js.map +0 -1
  104. package/dist/6148.jclic-node.js +0 -345
  105. package/dist/6148.jclic-node.js.map +0 -1
  106. package/dist/6176.jclic-node.js +0 -481
  107. package/dist/6176.jclic-node.js.map +0 -1
  108. package/dist/6221.jclic-node.js +0 -1072
  109. package/dist/6221.jclic-node.js.map +0 -1
  110. package/dist/6238.jclic-node.js +0 -718
  111. package/dist/6238.jclic-node.js.map +0 -1
  112. package/dist/6454.jclic-node.js +0 -1413
  113. package/dist/6454.jclic-node.js.map +0 -1
  114. package/dist/6565.jclic-node.js +0 -294
  115. package/dist/6565.jclic-node.js.map +0 -1
  116. package/dist/6579.jclic-node.js +0 -719
  117. package/dist/6579.jclic-node.js.map +0 -1
  118. package/dist/6715.jclic-node.js +0 -148
  119. package/dist/6715.jclic-node.js.map +0 -1
  120. package/dist/6777.jclic-node.js +0 -171
  121. package/dist/6777.jclic-node.js.map +0 -1
  122. package/dist/6782.jclic-node.js +0 -1611
  123. package/dist/6782.jclic-node.js.map +0 -1
  124. package/dist/6847.jclic-node.js +0 -601
  125. package/dist/6847.jclic-node.js.map +0 -1
  126. package/dist/6856.jclic-node.js +0 -252
  127. package/dist/6856.jclic-node.js.map +0 -1
  128. package/dist/696.jclic-node.js +0 -1821
  129. package/dist/696.jclic-node.js.map +0 -1
  130. package/dist/698.jclic-node.js +0 -583
  131. package/dist/698.jclic-node.js.map +0 -1
  132. package/dist/704.jclic-node.js +0 -80
  133. package/dist/704.jclic-node.js.map +0 -1
  134. package/dist/7046.jclic-node.js +0 -735
  135. package/dist/7046.jclic-node.js.map +0 -1
  136. package/dist/7220.jclic-node.js +0 -156
  137. package/dist/7220.jclic-node.js.map +0 -1
  138. package/dist/7257.jclic-node.js +0 -931
  139. package/dist/7257.jclic-node.js.map +0 -1
  140. package/dist/743.jclic-node.js +0 -583
  141. package/dist/743.jclic-node.js.map +0 -1
  142. package/dist/757.jclic-node.js +0 -1072
  143. package/dist/757.jclic-node.js.map +0 -1
  144. package/dist/7781.jclic-node.js +0 -202
  145. package/dist/7781.jclic-node.js.map +0 -1
  146. package/dist/7912.jclic-node.js +0 -2103
  147. package/dist/7912.jclic-node.js.map +0 -1
  148. package/dist/827.jclic-node.js +0 -708
  149. package/dist/827.jclic-node.js.map +0 -1
  150. package/dist/8276.jclic-node.js +0 -409
  151. package/dist/8276.jclic-node.js.map +0 -1
  152. package/dist/8322.jclic-node.js +0 -498
  153. package/dist/8322.jclic-node.js.map +0 -1
  154. package/dist/8641.jclic-node.js +0 -360
  155. package/dist/8641.jclic-node.js.map +0 -1
  156. package/dist/8837.jclic-node.js +0 -651
  157. package/dist/8837.jclic-node.js.map +0 -1
  158. package/dist/8895.jclic-node.js +0 -151
  159. package/dist/8895.jclic-node.js.map +0 -1
  160. package/dist/9072.jclic-node.js +0 -1285
  161. package/dist/9072.jclic-node.js.map +0 -1
  162. package/dist/9078.jclic-node.js +0 -935
  163. package/dist/9078.jclic-node.js.map +0 -1
  164. package/dist/9103.jclic-node.js +0 -718
  165. package/dist/9103.jclic-node.js.map +0 -1
  166. package/dist/9359.jclic-node.js +0 -145
  167. package/dist/9359.jclic-node.js.map +0 -1
  168. package/dist/9409.jclic-node.js +0 -921
  169. package/dist/9409.jclic-node.js.map +0 -1
  170. package/dist/9513.jclic-node.js +0 -720
  171. package/dist/9513.jclic-node.js.map +0 -1
  172. package/dist/9704.jclic-node.js +0 -81
  173. package/dist/9704.jclic-node.js.map +0 -1
  174. package/dist/9950.jclic-node.js +0 -827
  175. package/dist/9950.jclic-node.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"8837.jclic-node.js","mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEuB;AACc;AACiB;;AAEtD;AACA,yBAAyB,yCAAyC;AAClE,QAAQ,kGAAkG;AAC1G;AACA,gDAAgD,kDAAkD,YAAY,iDAAiD;AAC/J;AACA;AACO,0BAA0B,oDAAQ;AACzC;AACA;AACA,aAAa,gCAAgC,UAAU,kDAAkD;AACzG;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,sCAAsC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,uBAAuB;AAC7C;;AAEA,MAAM,wDAAG;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,iDAAiD,iBAAiB,GAAG,YAAY,EAAE,YAAY;AAC/F;AACA,WAAW;AACX,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS,+DAAU;AACnB,0BAA0B,cAAc;AACxC;AACA,yBAAyB,eAAe,KAAK,gBAAgB,EAAE,cAAc;;AAE7E;AACA;AACA;AACA;AACA;AACA,UAAU,6CAAC;AACX,2BAA2B,6CAAC;AAC5B;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,2DAAM;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,iDAAiD,IAAI;AACrD,WAAW;AACX,SAAS;AACT;AACA;AACA,uDAAuD,iBAAiB,GAAG,YAAY,EAAE,YAAY;AACrG,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA,aAAa,0CAA0C,WAAW,6DAA6D;AAC/H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,eAAe,kBAAkB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wCAAwC,6CAAC;AACzC;AACA,eAAe;AACf;AACA;AACA,gEAAgE,iBAAiB,GAAG,YAAY,EAAE,YAAY;AAC9G,eAAe;AACf,WAAW;AACX,UAAU;AACV;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA,eAAe,kBAAkB;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B,eAAe,gBAAgB,OAAO,sBAAsB;AAC5D;AACA,kBAAkB,gEAAgE;AAClF;AACA;AACA;AACA;AACA,MAAM,kDAAM;AACZ;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA,eAAe,kBAAkB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,6CAAC;AACb,6BAA6B,6CAAC;AAC9B,mCAAmC,kDAAkD;AACrF,aAAa;AACb;AACA,WAAW;AACX;AACA,wDAAwD,iBAAiB,GAAG,YAAY,EAAE,YAAY;AACtG,WAAW;AACX;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,kBAAkB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,6CAAC;AACb,4BAA4B,6CAAC;AAC7B,6BAA6B;AAC7B;AACA;AACA;AACA,aAAa;AACb;AACA,WAAW;AACX;AACA,uDAAuD,iBAAiB,GAAG,YAAY,EAAE,YAAY;AACrG,WAAW;AACX;AACA,KAAK;AACL;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe,kBAAkB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,6CAAC;AAC3B;AACA,2BAA2B,2DAAM;AACjC;AACA,cAAc;AACd,6BAA6B;AAC7B;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,sDAAsD,iBAAiB,GAAG,YAAY,EAAE,YAAY;AACpG,WAAW;AACX;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,eAAe,kBAAkB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,iBAAiB,GAAG,2DAAM,kBAAkB;AAChF;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA,iBAAiB,uDAAuD;AACxE;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA,aAAa,0BAA0B,WAAW,yCAAyC;AAC3F;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,uCAAuC;AACnD;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA,cAAc,uDAAuD;AACrE;AACA,YAAY,wCAAwC;AACpD;AACA;AACA;AACA;AACA,YAAY,wCAAwC;AACpD;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA,CAAC;;AAED;AACA;AACA;AACA;AACO;AACP;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA,iBAAiB,6CAAC,mBAAmB,QAAQ;AAC7C;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,uBAAuB;AACpC;AACA;AACA;AACA,sBAAsB,6CAAC,oBAAoB,0BAA0B;AACrE;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,iBAAiB;AAC7B;AACA,CAAC;;AAED;;AAEA;AACA,iEAAe,oDAAQ,0CAA0C,EAAC","sources":["webpack://jclic/./src/report/TCPReporter.js"],"sourcesContent":["/**\n * File : report/TCPReporter.js\n * Created : 08/06/2016\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\n/* global Promise, document, window, XMLSerializer */\n\nimport $ from 'jquery';\nimport Reporter from './Reporter.js';\nimport { log, startsWith, getMsg } from '../Utils.js';\n\n/**\n * This special case of {@link module:Reporter.Reporter Reporter} connects with an external service reporter providing\n * the {@link https://github.com/projectestac/jclic/wiki/JClic-Reports-developers-guide JClic Reports API}.\n * Connection parameters to the reports server (`path`, `service`, `userId`, `key`, `context`...)\n * are passed through the `options` element of {@link module:JClicPlayer.JClicPlayer JClicPlayer} (acting as {@link module:JClicPlayer.JClicPlayer JClicPlayer}).\n * @extends module:reports/Reporter.Reporter\n */\nexport class TCPReporter extends Reporter {\n /**\n * TCPReporter constructor\n * @param {module:JClicPlayer.JClicPlayer} ps - The {@link module:JClicPlayer.JClicPlayer JClicPlayer} used to retrieve settings and localized messages\n */\n constructor(ps) {\n super(ps);\n this.tasks = [];\n }\n\n /**\n * Gets a specific property from this reporting system\n * @override\n * @param {string} key - Requested property\n * @param {string}+ defaultValue - Default return value when requested property does not exist\n * @returns {string}\n */\n getProperty(key, defaultValue) {\n return this.dbProperties !== null && this.dbProperties.hasOwnProperty(key) ?\n this.dbProperties[key] :\n defaultValue;\n }\n\n /**\n * Adds a new element to the list of report beans pending to be transmitted.\n * @param {module:report/TCPReporter.ReportBean} bean\n */\n addTask(bean) {\n if (this.processingTasks) {\n if (this.waitingTasks === null)\n this.waitingTasks = [bean];\n else\n this.waitingTasks.push(bean);\n } else\n this.tasks.push(bean);\n }\n\n /**\n * Transmits all report beans currently stored in `tasks` to the reports server\n * @returns {external:Promise}\n */\n flushTasksPromise() {\n if (this.processingTasks || this.currentSessionId === null ||\n this.tasks.length === 0 || this.serviceUrl === null) {\n // The task list cannot be processed now. Pass and wait until the next timer cycle:\n if (this.processingTasks)\n this.forceFlush = true;\n return Promise.resolve(true);\n }\n else {\n // Set up the `processingTasks` flag to avoid re-entrant processing\n this.processingTasks = true;\n\n const reportBean = new ReportBean('multiple');\n for (let i = 0; i < this.tasks.length; i++)\n reportBean.appendData(this.tasks[i].$bean);\n\n log('debug', 'Reporting:', reportBean.$bean[0]);\n\n return new Promise((resolve, reject) => {\n this.transaction(reportBean.$bean)\n .done((_data, _textStatus, _jqXHR) => {\n // TODO: Check returned message for possible errors on the server side\n this.failCount = 0;\n\n // Clear waiting tasks\n if (this.waitingTasks) {\n this.tasks = this.waitingTasks;\n this.waitingTasks = null;\n }\n else {\n this.forceFlush = false;\n this.tasks = [];\n }\n\n if (this.forceFlush && this.tasks.length > 0) {\n this.forceFlush = false;\n this.processingTasks = false;\n this.flushTasksPromise().then(() => {\n resolve(true);\n });\n }\n else {\n this.forceFlush = false;\n resolve(true);\n this.processingTasks = false;\n }\n })\n .fail((jqXHR, textStatus, errorThrown) => {\n if (++this.failCount > this.maxFails)\n this.stopReporting().then();\n reject(`Error reporting results to ${this.serviceUrl} [${textStatus} ${errorThrown}]`);\n this.processingTasks = false;\n });\n });\n }\n }\n\n /**\n * Initializes this report system with an optional set of parameters.\n * Returns a Promise, fulfilled when the reporter is fully initialized.\n * @override\n * @param {object} [options] - Initial settings passed to the reporting system\n * @returns {external:Promise}\n */\n init(options) {\n if (typeof options === 'undefined' || options === null)\n options = this.ps.options;\n super.init(options);\n this.initiated = false;\n this.stopReporting();\n\n this.serverPath = options.path || this.DEFAULT_SERVER_PATH;\n this.descriptionDetail = this.serverPath;\n let serverService = options.service || this.DEFAULT_SERVER_SERVICE;\n if (!startsWith(serverService, '/'))\n serverService = `/${serverService}`;\n const serverProtocol = options.protocol || this.DEFAULT_SERVER_PROTOCOL;\n this.serviceUrl = `${serverProtocol}://${this.serverPath}${serverService}`;\n\n const bean = new ReportBean('get_properties');\n return new Promise((resolve, reject) => {\n this.transaction(bean.$bean)\n .done((data, _textStatus, _jqXHR) => {\n this.dbProperties = {};\n $(data).find('param').each((_n, param) => {\n const $param = $(param);\n this.dbProperties[$param.attr('name')] = $param.attr('value');\n });\n this.promptUserId(false).then(userId => {\n this.userId = userId;\n const tl = options.lap || this.getProperty('TIME_LAP', this.DEFAULT_TIMER_LAP);\n this.timerLap = Math.min(30, Math.max(1, parseInt(tl)));\n this.timer = window.setInterval(() => this.flushTasksPromise().then(), this.timerLap * 1000);\n // Warn before leaving the current page with unsaved data:\n this.beforeUnloadFunction = event => {\n if (this.serviceUrl !== null &&\n (this.tasks.length > 0 || this.processingTasks)) {\n this.flushTasksPromise().then();\n const result = getMsg('Please wait until the results of your activities are sent to the reports system');\n if (event)\n event.returnValue = result;\n return result;\n }\n };\n window.addEventListener('beforeunload', this.beforeUnloadFunction);\n this.initiated = true;\n resolve(true);\n }).catch(msg => {\n this.stopReporting();\n reject(`Error getting the user ID: ${msg}`);\n });\n })\n .fail((jqXHR, textStatus, errorThrown) => {\n this.stopReporting();\n reject(`Error initializing reports service ${this.serviceUrl} [${textStatus} ${errorThrown}]`);\n });\n });\n }\n\n /**\n * This method should be invoked when a new session starts.\n * @override\n * @param {module:project/JClicProject.JClicProject} jcp - The {@link module:project/JClicProject.JClicProject JClicProject} this session refers to.\n */\n newSession(jcp) {\n super.newSession(jcp);\n if (this.serviceUrl && this.userId !== null) {\n // Session ID will be obtained when reporting first activity\n this.currentSessionId = null;\n }\n }\n\n /**\n * Creates a new session in the remote database and records its ID for future use\n * @param {boolean} forceNewSession - When `true`, a new session will always be created.\n * @returns {external:Promise} - A Promise reporter will be successfully resolved\n * only when `currentSessionId` have a valid value.\n */\n createDBSession(forceNewSession) {\n if (this.currentSessionId !== null && !forceNewSession)\n // A valid session is available, so just return it\n return Promise.resolve(this.currentSessionId);\n else\n // A new session must be created:\n return new Promise((resolve, reject) => {\n if (this.initiated && this.userId !== null && this.currentSession !== null) {\n this.flushTasksPromise().then(() => {\n this.currentSessionId = null;\n const bean = new ReportBean('add session');\n\n bean.setParam('project', this.currentSession.projectName);\n bean.setParam('activities', Number(this.currentSession.reportableActs));\n bean.setParam('time', Number(this.currentSession.started));\n bean.setParam('code', this.currentSession.code);\n bean.setParam('user', this.userId);\n bean.setParam('key', this.sessionKey);\n bean.setParam('context', this.sessionContext);\n\n this.transaction(bean.$bean)\n .done((data, _textStatus, _jqXHR) => {\n this.currentSessionId = $(data).find('param[name=\"session\"]').attr('value');\n resolve(this.currentSessionId);\n })\n .fail((jqXHR, textStatus, errorThrown) => {\n this.stopReporting();\n reject(`Error creating new reports session in ${this.serviceUrl} [${textStatus} ${errorThrown}]`);\n });\n });\n } else\n reject('Unable to start session in remote server!');\n });\n }\n\n /**\n * Closes this reporting system\n * @override\n * @returns {external:Promise} - A promise to be fullfilled when all pending tasks are finished, or _null_ if not active.\n */\n end() {\n this.reportActivity(true);\n return this.stopReporting().then(super.end());\n }\n\n /**\n * Performs a transaction on the remote server\n * @param {external:jQuery} $xml - The XML element to be transmited, wrapped into a jQuery object\n * @returns {external:jqXHR} - The {@link external:jqXHR} obtained as a result of a call to `$.ajax`.\n * This object should be treated as a Promise or\n * as a JQuery {@link https://api.jquery.com/category/deferred-object|Deferred} object.\n */\n transaction($xml) {\n return this.serviceUrl === null ?\n null :\n $.ajax({\n method: 'POST',\n url: this.serviceUrl,\n data: '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' +\n (new XMLSerializer()).serializeToString($xml.get(0)).replace('minactions', 'minActions').replace('reportactions', 'reportActions'),\n contentType: 'text/xml',\n dataType: 'xml'\n });\n }\n\n /**\n * Gets the list of current groups or organizations registered on this reporting system.\n * @override\n * @returns {external:Promise} - When fulfilled, an array of group data is returned as a result\n */\n getGroups() {\n return new Promise((resolve, reject) => {\n if (!this.userBased())\n reject('This system does not manage users!');\n else {\n const bean = new ReportBean('get groups');\n this.transaction(bean.$bean)\n .done((data, _textStatus, _jqXHR) => {\n const currentGroups = [];\n $(data).find('group').each((_n, gr) => {\n const $group = $(gr);\n currentGroups.push({ id: $group.attr('id'), name: $group.attr('name') });\n });\n resolve(currentGroups);\n })\n .fail((jqXHR, textStatus, errorThrown) => {\n reject(`Error retrieving groups list from ${this.serviceUrl} [${textStatus} ${errorThrown}]`);\n });\n }\n });\n }\n\n /**\n * Gets the list of users currently registered in the system, optionally filtered by\n * a specific group ID.\n * @override\n * @param {string}+ groupId - Optional group ID to be used as a filter criteria\n * @returns {external:Promise} - When fulfilled, an object with a collection of user data records\n * is returned\n */\n getUsers(groupId) {\n return new Promise((resolve, reject) => {\n if (!this.userBased())\n reject('This system does not manage users!');\n else {\n const bean = new ReportBean('get users');\n if (typeof groupId !== 'undefined' && groupId !== null)\n bean.setParam('group', groupId);\n this.transaction(bean.$bean)\n .done((data, _textStatus, _jqXHR) => {\n const currentUsers = [];\n $(data).find('user').each((_n, usr) => {\n const $user = $(usr);\n const user = { id: $user.attr('id'), name: $user.attr('name') };\n if ($user.attr('pwd'))\n user.pwd = $user.attr('pwd');\n currentUsers.push(user);\n });\n resolve(currentUsers);\n })\n .fail((jqXHR, textStatus, errorThrown) => {\n reject(`Error retrieving users list from ${this.serviceUrl} [${textStatus} ${errorThrown}]`);\n });\n }\n });\n }\n\n /**\n * Gets extended data associated with a specific user.\n * @param {string} userId - The requested user ID\n * @returns {external:Promise} - When fulfilled, an object with user data is returned.\n */\n getUserData(userId) {\n return new Promise((resolve, reject) => {\n if (!this.userBased())\n reject('This system does not manage users!');\n else {\n const bean = new ReportBean('get user data');\n\n if (typeof userId !== 'undefined' && userId !== null)\n bean.setParam('user', userId);\n else\n reject('Invalid user ID');\n\n this.transaction(bean.$bean)\n .done((data, _textStatus, _jqXHR) => {\n const $user = $(data).find('user');\n if ($user.length !== 1) {\n window.alert(getMsg('Invalid user'));\n resolve('Invalid user ID');\n } else {\n const user = { id: $user.attr('id'), name: $user.attr('name') };\n if ($user.attr('pwd'))\n user.pwd = $user.attr('pwd');\n resolve(user);\n }\n })\n .fail((jqXHR, textStatus, errorThrown) => {\n reject(`Error retrieving user data from ${this.serviceUrl} [${textStatus} ${errorThrown}]`);\n });\n }\n });\n }\n\n /**\n * Stops the reporting system, usually as a result of repeated errors or because the player\n * shuts down.\n * @returns {external:Promise} - A promise to be fullfilled when all pending tasks are finished.\n */\n stopReporting() {\n let result = null;\n if (this.timer >= 0) {\n window.clearInterval(this.timer);\n this.timer = -1;\n }\n if (this.beforeUnloadFunction) {\n window.removeEventListener('beforeunload', this.beforeUnloadFunction);\n this.beforeUnloadFunction = null;\n }\n if (this.initiated) {\n result = this.flushTasksPromise().then(() => {\n this.serviceUrl = null;\n this.descriptionDetail = `${this.serverPath} (${getMsg('not connected')})`;\n this.initiated = false;\n });\n }\n return result || Promise.resolve(true);\n }\n\n /**\n * Prepares a {@link module:report/TCPReporter.ReportBean ReportBean} object with information related to the current\n * activity, and pushes it into the list of pending `tasks`, to be processed by the main `timer`.\n * @param {boolean} flushNow - When `true`, the activity data will be sent to server as soon as possible\n */\n reportActivity(flushNow) {\n if (this.lastActivity) {\n if (!this.lastActivity.closed)\n this.lastActivity.closeActivity();\n const\n actCount = this.actCount++,\n act = this.lastActivity;\n this.createDBSession(false).then(() => {\n const bean = new ReportBean('add activity');\n bean.setParam('session', this.currentSessionId);\n bean.setParam('num', actCount);\n bean.appendData(act.$getXML());\n this.addTask(bean);\n if (flushNow)\n this.flushTasksPromise().then();\n });\n }\n if (this.currentSession !== null &&\n this.currentSession.currentSequence !== null &&\n this.currentSession.currentSequence.currentActivity !== this.lastActivity) {\n this.lastActivity = this.currentSession.currentSequence.currentActivity;\n } else\n this.lastActivity = null;\n }\n\n /**\n * This method should be invoked when the user starts a new activity\n * @override\n * @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} reporter has just started\n */\n newActivity(act) {\n super.newActivity(act);\n this.reportActivity(false);\n }\n\n /**\n * This method should be called when the current activity finishes. Data about user's final results\n * on the activity will then be saved.\n * @override\n * @param {number} score - The final score, usually in a 0-100 scale.\n * @param {number} numActions - The total number of actions done by the user to solve the activity\n * @param {boolean} solved - `true` if the activity was finally solved, `false` otherwise.\n */\n endActivity(score, numActions, solved) {\n super.endActivity(score, numActions, solved);\n this.reportActivity(true);\n }\n}\n\nObject.assign(TCPReporter.prototype, {\n /**\n * Description of this reporting system\n * @name module:report/TCPReporter.TCPReporter#descriptionKey\n * @override\n * @type {string} */\n descriptionKey: 'Reporting to remote server',\n /**\n * Additional info to display after the reporter's `description`\n * @name module:report/TCPReporter.TCPReporter#descriptionDetail\n * @override\n * @type {string} */\n descriptionDetail: '(not connected)',\n /**\n * Main path of the reports server (without protocol nor service)\n * @name module:report/TCPReporter.TCPReporter#serverPath\n * @type {string} */\n serverPath: '',\n /**\n * Function to be called by the browser before leaving the current page\n * @name module:report/TCPReporter.TCPReporter#beforeUnloadFunction\n * @type {function} */\n beforeUnloadFunction: null,\n /**\n * Identifier of the current session, provided by the server\n * @name module:report/TCPReporter.TCPReporter#currentSessionId\n * @type {string} */\n currentSessionId: '',\n /**\n * Last activity reported\n * @name module:report/TCPReporter.TCPReporter#lastActivity\n * @type {module:report/ActivityReg.ActivityReg} */\n lastActivity: null,\n /**\n * Number of activities processed\n * @name module:report/TCPReporter.TCPReporter#actCount\n * @type {number} */\n actCount: 0,\n /**\n * Service URL of the JClic Reports server\n * @name module:report/TCPReporter.TCPReporter#serviceUrl\n * @type {string} */\n serviceUrl: null,\n /**\n * Object used to store specific properties of the connected reports system\n * @name module:report/TCPReporter.TCPReporter#dbProperties\n * @type {object} */\n dbProperties: null,\n /**\n * List of {@link module:report/TCPReporter.ReportBean ReportBean} objects pending to be processed\n * @name module:report/TCPReporter.TCPReporter#tasks\n * @type {module:report/TCPReporter.ReportBean[]} */\n tasks: null,\n /**\n * Waiting list of tasks, to be used while `tasks` is being processed\n * @name module:report/TCPReporter.TCPReporter#waitingTasks\n * @type {module:report/TCPReporter.ReportBean[]} */\n waitingTasks: null,\n /**\n * Flag used to indicate if `transaction` is currently running\n * @name module:report/TCPReporter.TCPReporter#processingTasks\n * @type {boolean} */\n processingTasks: false,\n /**\n * Force processing of pending tasks as soon as possible\n * @name module:report/TCPReporter.TCPReporter#forceFlush\n * @type {boolean} */\n forceFlush: false,\n /**\n * Identifier of the background function obtained with a call to `window.setInterval`\n * @name module:report/TCPReporter.TCPReporter#timer\n * @type {number} */\n timer: -1,\n /**\n * Time between calls to the background function, in seconds\n * @name module:report/TCPReporter.TCPReporter#timerLap\n * @type {number} */\n timerLap: 5,\n /**\n * Counter of unsuccessful connection attempts with the report server\n * @name module:report/TCPReporter.TCPReporter#failCount\n * @type {number} */\n failCount: 0,\n /**\n * Maximum number of failed attempts allowed before disconnecting\n * @name module:report/TCPReporter.TCPReporter#maxFails\n * @type {number} */\n maxFails: 5,\n /**\n * Default path of JClic Reports Server\n * @name module:report/TCPReporter.TCPReporter#DEFAULT_SERVER_PATH\n * @type {string} */\n DEFAULT_SERVER_PATH: 'localhost:9000',\n /**\n * Default name for the reports service\n * @name module:report/TCPReporter.TCPReporter#DEFAULT_SERVER_SERVICE\n * @type {string} */\n DEFAULT_SERVER_SERVICE: '/JClicReportService',\n /**\n * Default server protocol\n * Use always 'https' except when in 'http' and protocol not set in options\n * @name module:report/TCPReporter.TCPReporter#DEFAULT_SERVER_PROTOCOL\n * @type {string} */\n DEFAULT_SERVER_PROTOCOL: (document && document.location && document.location.protocol === 'http:') ? 'http' : 'https',\n /**\n * Default lap between calls to `flushTasks`, in seconds\n * @name module:report/TCPReporter.TCPReporter#DEFAULT_TIMER_LAP\n * @type {number} */\n DEFAULT_TIMER_LAP: 20,\n});\n\n/**\n * This inner class encapsulates a chunk of information in XML format, ready to be\n * transmitted to the remote reports server.\n */\nexport class ReportBean {\n /**\n * ReportBean constructor\n * @param id {string} - The main identifier of this ReportBean. Current valid values are:\n * `get property`, `get_properties`, `add session`, `add activity`, `get groups`, `get users`,\n * `get user data`, `get group data`, `new group`, `new user` and `multiple`.\n * @param $data {external:jQuery}+ - Optional XML data to be added to this bean\n */\n constructor(id, $data) {\n this.$bean = $('<bean/>').attr({ id: id });\n if ($data)\n this.appendData($data);\n }\n\n /**\n * Adds an XML element to the bean\n * @param {external:jQuery} $data - The XML element to be added to this bean\n */\n appendData($data) {\n if ($data) {\n this.$bean.append($data);\n }\n }\n\n /**\n * Adds an XML element of type `param` to this ReportBean\n * @param {string} name - The key name of the parameter\n * @param {string|number|boolean} value - The value of the parameter\n */\n setParam(name, value) {\n if (typeof value !== 'undefined' && value !== null)\n this.appendData($('<param/>').attr({ name: name, value: value }));\n }\n}\n\nObject.assign(ReportBean.prototype, {\n /**\n * The main jQuery XML object managed by this ReportBean\n * @name module:report/TCPReporter.ReportBean#$bean\n * @type {external:jQuery} */\n $bean: null,\n});\n\nTCPReporter.ReportBean = ReportBean;\n\n// Register class in Reporter.CLASSES\nexport default Reporter.registerClass('TCPReporter', TCPReporter);\n"],"names":[],"sourceRoot":""}
@@ -1,151 +0,0 @@
1
- "use strict";
2
- exports.id = 8895;
3
- exports.ids = [8895];
4
- exports.modules = {
5
-
6
- /***/ 8895:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
11
- /* harmony export */ });
12
- /* unused harmony export SessionStorageReporter */
13
- /* harmony import */ var _Reporter_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6782);
14
- /**
15
- * File : report/SessionStorageReporter.js
16
- * Created : 06/09/2017
17
- * By : Francesc Busquets <francesc@gmail.com>
18
- *
19
- * JClic.js
20
- * An HTML5 player of JClic activities
21
- * https://projectestac.github.io/jclic.js
22
- *
23
- * @source https://github.com/projectestac/jclic.js
24
- *
25
- * @license EUPL-1.2
26
- * @licstart
27
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
28
- *
29
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
30
- * the European Commission- subsequent versions of the EUPL (the "Licence");
31
- * You may not use this work except in compliance with the Licence.
32
- *
33
- * You may obtain a copy of the Licence at:
34
- * https://joinup.ec.europa.eu/software/page/eupl
35
- *
36
- * Unless required by applicable law or agreed to in writing, software
37
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
38
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
39
- * Licence for the specific language governing permissions and limitations
40
- * under the Licence.
41
- * @licend
42
- * @module
43
- */
44
-
45
- /* global window */
46
-
47
-
48
-
49
- /**
50
- * This JClic {@link module:Reporter.Reporter Reporter} writes persistent data to the browser local session storage. It uses some of
51
- * the {@link https://github.com/projectestac/jclic/wiki/JClic-Reports-developers-guide JClic Reports API}.
52
- * Connection parameters (`key`, `context`...) are passed through the `options` element of {@link module:JClicPlayer.JClicPlayer JClicPlayer} (acting as {@link module:JClicPlayer.JClicPlayer JClicPlayer}).
53
- * Set `storage=local` in `options` to store reports in [`window.localStorage`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage}
54
- * instead of [`window.sessionStorage`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage} (default).
55
- * @extends module:reports/Reporter.Reporter
56
- */
57
- class SessionStorageReporter extends _Reporter_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
58
- /**
59
- * SessionStorageReporter constructor
60
- * @param {module:JClicPlayer.JClicPlayer} ps - The {@link module:JClicPlayer.JClicPlayer JClicPlayer} used to retrieve settings and localized messages
61
- */
62
- constructor(ps) {
63
- super(ps);
64
- this.key = `jclic_${(new Date()).toISOString()}#${Math.ceil(Math.random() * 1000)}`;
65
- }
66
-
67
- /**
68
- * Initializes this report system with an optional set of parameters.
69
- * Returns a Promise, fulfilled when the reporter is fully initialized.
70
- * @override
71
- * @param {object} [options] - Initial settings passed to the reporting system
72
- * @returns {external:Promise}
73
- */
74
- init(options) {
75
- if (typeof options === 'undefined' || options === null)
76
- options = this.ps.options;
77
- if (options.storage === 'local') {
78
- this.storage = window.localStorage;
79
- this.descriptionKey = 'Reporting to local storage';
80
- }
81
- return _Reporter_js__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.init.call(this, options);
82
- }
83
-
84
- /**
85
- *
86
- * Saves the current report data to sessionStorage
87
- */
88
- saveCurrentReport() {
89
- // Update results out of current thread
90
- window.setTimeout(() => {
91
- this.storage.setItem(this.key, JSON.stringify(this.getData()));
92
- }, 0);
93
- }
94
-
95
- /**
96
- * Finalizes the current sequence
97
- * @override
98
- */
99
- endSequence() {
100
- super.endSequence();
101
- this.saveCurrentReport();
102
- }
103
-
104
- /**
105
- * This method should be called when the current activity finishes. Data about user's final results
106
- * on the activity will then be saved.
107
- * @override
108
- * @param {number} score - The final score, usually in a 0-100 scale.
109
- * @param {number} numActions - The total number of actions done by the user to solve the activity
110
- * @param {boolean} solved - `true` if the activity was finally solved, `false` otherwise.
111
- */
112
- endActivity(score, numActions, solved) {
113
- super.endActivity(score, numActions, solved);
114
- this.saveCurrentReport();
115
- }
116
- }
117
-
118
- Object.assign(SessionStorageReporter.prototype, {
119
- /**
120
- * Type of storage to be used. Defaults to `window.sessionStorage`
121
- * @name module:report/SessionStorageReporter.SessionStorageReporter#storage
122
- * @type {external:Storage} */
123
- storage: window.sessionStorage,
124
- /**
125
- * Description of this reporting system
126
- * @name module:report/SessionStorageReporter.SessionStorageReporter#descriptionKey
127
- * @override
128
- * @type {string} */
129
- descriptionKey: 'Reporting to session storage',
130
- /**
131
- * Additional info to display after the reporter's `description`
132
- * @name module:report/SessionStorageReporter.SessionStorageReporter#descriptionDetail
133
- * @override
134
- * @type {string} */
135
- descriptionDetail: '(browser session)',
136
- /**
137
- * Key used to save the report into sessionStorage
138
- * @name module:report/SessionStorageReporter.SessionStorageReporter#key
139
- * @type {string} */
140
- key: null,
141
- });
142
-
143
- // Register class in Reporter.CLASSES
144
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Reporter_js__WEBPACK_IMPORTED_MODULE_0__["default"].registerClass('SessionStorageReporter', SessionStorageReporter));
145
-
146
-
147
- /***/ })
148
-
149
- };
150
- ;
151
- //# sourceMappingURL=8895.jclic-node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"8895.jclic-node.js","mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEqC;;AAErC;AACA,eAAe,yCAAyC;AACxD,QAAQ,kGAAkG;AAC1G,4FAA4F,kDAAkD,YAAY,iDAAiD;AAC3M,gFAAgF;AAChF,wCAAwC,8EAA8E;AACtH;AACA;AACO,qCAAqC,oDAAQ;AACpD;AACA;AACA,aAAa,gCAAgC,UAAU,kDAAkD;AACzG;AACA;AACA;AACA,wBAAwB,2BAA2B,GAAG,gCAAgC;AACtF;;AAEA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,oDAAQ;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA,CAAC;;AAED;AACA,iEAAe,oDAAQ,gEAAgE,EAAC","sources":["webpack://jclic/./src/report/SessionStorageReporter.js"],"sourcesContent":["/**\n * File : report/SessionStorageReporter.js\n * Created : 06/09/2017\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\n/* global window */\n\nimport Reporter from './Reporter.js';\n\n/**\n * This JClic {@link module:Reporter.Reporter Reporter} writes persistent data to the browser local session storage. It uses some of\n * the {@link https://github.com/projectestac/jclic/wiki/JClic-Reports-developers-guide JClic Reports API}.\n * Connection parameters (`key`, `context`...) are passed through the `options` element of {@link module:JClicPlayer.JClicPlayer JClicPlayer} (acting as {@link module:JClicPlayer.JClicPlayer JClicPlayer}).\n * Set `storage=local` in `options` to store reports in [`window.localStorage`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage}\n * instead of [`window.sessionStorage`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage} (default).\n * @extends module:reports/Reporter.Reporter\n */\nexport class SessionStorageReporter extends Reporter {\n /**\n * SessionStorageReporter constructor\n * @param {module:JClicPlayer.JClicPlayer} ps - The {@link module:JClicPlayer.JClicPlayer JClicPlayer} used to retrieve settings and localized messages\n */\n constructor(ps) {\n super(ps);\n this.key = `jclic_${(new Date()).toISOString()}#${Math.ceil(Math.random() * 1000)}`;\n }\n\n /**\n * Initializes this report system with an optional set of parameters.\n * Returns a Promise, fulfilled when the reporter is fully initialized.\n * @override\n * @param {object} [options] - Initial settings passed to the reporting system\n * @returns {external:Promise}\n */\n init(options) {\n if (typeof options === 'undefined' || options === null)\n options = this.ps.options;\n if (options.storage === 'local') {\n this.storage = window.localStorage;\n this.descriptionKey = 'Reporting to local storage';\n }\n return Reporter.prototype.init.call(this, options);\n }\n\n /**\n *\n * Saves the current report data to sessionStorage\n */\n saveCurrentReport() {\n // Update results out of current thread\n window.setTimeout(() => {\n this.storage.setItem(this.key, JSON.stringify(this.getData()));\n }, 0);\n }\n\n /**\n * Finalizes the current sequence\n * @override\n */\n endSequence() {\n super.endSequence();\n this.saveCurrentReport();\n }\n\n /**\n * This method should be called when the current activity finishes. Data about user's final results\n * on the activity will then be saved.\n * @override\n * @param {number} score - The final score, usually in a 0-100 scale.\n * @param {number} numActions - The total number of actions done by the user to solve the activity\n * @param {boolean} solved - `true` if the activity was finally solved, `false` otherwise.\n */\n endActivity(score, numActions, solved) {\n super.endActivity(score, numActions, solved);\n this.saveCurrentReport();\n }\n}\n\nObject.assign(SessionStorageReporter.prototype, {\n /**\n * Type of storage to be used. Defaults to `window.sessionStorage`\n * @name module:report/SessionStorageReporter.SessionStorageReporter#storage\n * @type {external:Storage} */\n storage: window.sessionStorage,\n /**\n * Description of this reporting system\n * @name module:report/SessionStorageReporter.SessionStorageReporter#descriptionKey\n * @override\n * @type {string} */\n descriptionKey: 'Reporting to session storage',\n /**\n * Additional info to display after the reporter's `description`\n * @name module:report/SessionStorageReporter.SessionStorageReporter#descriptionDetail\n * @override\n * @type {string} */\n descriptionDetail: '(browser session)',\n /**\n * Key used to save the report into sessionStorage\n * @name module:report/SessionStorageReporter.SessionStorageReporter#key\n * @type {string} */\n key: null,\n});\n\n// Register class in Reporter.CLASSES\nexport default Reporter.registerClass('SessionStorageReporter', SessionStorageReporter);\n"],"names":[],"sourceRoot":""}