@verdocs/web-sdk 1.9.10 → 1.9.14

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 (398) hide show
  1. package/dist/cjs/{Envelopes-22a0c02f.js → Envelopes-aec4ee3d.js} +4 -15
  2. package/dist/cjs/Envelopes-aec4ee3d.js.map +1 -0
  3. package/dist/cjs/{Templates-399073ea.js → Templates-0051d647.js} +2 -2
  4. package/dist/cjs/{Templates-399073ea.js.map → Templates-0051d647.js.map} +1 -1
  5. package/dist/cjs/VerdocsEndpoint-8c408e5b.js +3569 -0
  6. package/dist/cjs/VerdocsEndpoint-8c408e5b.js.map +1 -0
  7. package/dist/cjs/{templateStore-92828c3c.js → index-eb130f52.js} +2 -41
  8. package/dist/cjs/index-eb130f52.js.map +1 -0
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/templateStore-974781a8.js +46 -0
  11. package/dist/cjs/templateStore-974781a8.js.map +1 -0
  12. package/dist/cjs/{utils-84236321.js → utils-e0f38696.js} +23 -3
  13. package/dist/cjs/utils-e0f38696.js.map +1 -0
  14. package/dist/cjs/verdocs-auth.cjs.entry.js +1 -1
  15. package/dist/cjs/verdocs-build.cjs.entry.js +5 -4
  16. package/dist/cjs/verdocs-build.cjs.entry.js.map +1 -1
  17. package/dist/cjs/verdocs-contact-picker.cjs.entry.js +1 -1
  18. package/dist/cjs/verdocs-document-page_2.cjs.entry.js +94 -0
  19. package/dist/cjs/verdocs-document-page_2.cjs.entry.js.map +1 -0
  20. package/dist/cjs/verdocs-dropdown_3.cjs.entry.js +1 -1
  21. package/dist/cjs/verdocs-field-date.cjs.entry.js +1 -1
  22. package/dist/cjs/verdocs-field-dropdown.cjs.entry.js +1 -1
  23. package/dist/cjs/verdocs-field-initial.cjs.entry.js +1 -1
  24. package/dist/cjs/verdocs-field-payment.cjs.entry.js +1 -1
  25. package/dist/cjs/verdocs-field-signature_3.cjs.entry.js +1 -1
  26. package/dist/cjs/verdocs-field-textarea.cjs.entry.js +1 -1
  27. package/dist/cjs/verdocs-field-textbox.cjs.entry.js +3 -2
  28. package/dist/cjs/verdocs-field-textbox.cjs.entry.js.map +1 -1
  29. package/dist/cjs/verdocs-field-timestamp.cjs.entry.js +1 -1
  30. package/dist/cjs/verdocs-preview.cjs.entry.js +17 -11
  31. package/dist/cjs/verdocs-preview.cjs.entry.js.map +1 -1
  32. package/dist/cjs/verdocs-quick-functions_3.cjs.entry.js +1 -1
  33. package/dist/cjs/verdocs-search.cjs.entry.js +1 -1
  34. package/dist/cjs/verdocs-send.cjs.entry.js +2 -2
  35. package/dist/cjs/verdocs-sign.cjs.entry.js +91 -22
  36. package/dist/cjs/verdocs-sign.cjs.entry.js.map +1 -1
  37. package/dist/cjs/verdocs-template-create_4.cjs.entry.js +52 -36
  38. package/dist/cjs/verdocs-template-create_4.cjs.entry.js.map +1 -1
  39. package/dist/cjs/verdocs-view.cjs.entry.js +331 -0
  40. package/dist/cjs/verdocs-view.cjs.entry.js.map +1 -0
  41. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  42. package/dist/collection/collection-manifest.json +1 -3
  43. package/dist/collection/components/elements/verdocs-document-page/verdocs-document-page.js +1 -4
  44. package/dist/collection/components/elements/verdocs-document-page/verdocs-document-page.js.map +1 -1
  45. package/dist/collection/components/elements/verdocs-template-fields/verdocs-template-fields.css +14 -1
  46. package/dist/collection/components/elements/verdocs-template-fields/verdocs-template-fields.js +17 -30
  47. package/dist/collection/components/elements/verdocs-template-fields/verdocs-template-fields.js.map +1 -1
  48. package/dist/collection/components/embeds/verdocs-preview/verdocs-preview.css +15 -0
  49. package/dist/collection/components/embeds/verdocs-preview/verdocs-preview.js +14 -7
  50. package/dist/collection/components/embeds/verdocs-preview/verdocs-preview.js.map +1 -1
  51. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +124 -47
  52. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
  53. package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +122 -175
  54. package/dist/collection/components/embeds/verdocs-view/verdocs-view.js.map +1 -1
  55. package/dist/collection/components/embeds/verdocs-view/verdocs-view.stories.js +2 -3
  56. package/dist/collection/components/embeds/verdocs-view/verdocs-view.stories.js.map +1 -1
  57. package/dist/collection/utils/Envelopes.js +31 -0
  58. package/dist/collection/utils/Envelopes.js.map +1 -0
  59. package/dist/collection/utils/envelopeStore.js +28 -0
  60. package/dist/collection/utils/envelopeStore.js.map +1 -0
  61. package/dist/collection/utils/utils.js +21 -2
  62. package/dist/collection/utils/utils.js.map +1 -1
  63. package/dist/{esm/Envelopes-df05b3c7.js → components/Envelopes.js} +5 -15
  64. package/dist/components/Envelopes.js.map +1 -0
  65. package/dist/components/VerdocsEndpoint.js +2185 -1051
  66. package/dist/components/VerdocsEndpoint.js.map +1 -1
  67. package/dist/components/index.d.ts +0 -2
  68. package/dist/components/index.js +0 -2
  69. package/dist/components/index.js.map +1 -1
  70. package/dist/components/index2.js +196 -0
  71. package/dist/components/index2.js.map +1 -0
  72. package/dist/components/templateStore.js +1 -192
  73. package/dist/components/templateStore.js.map +1 -1
  74. package/dist/components/utils.js +22 -3
  75. package/dist/components/utils.js.map +1 -1
  76. package/dist/components/verdocs-build.js +34 -52
  77. package/dist/components/verdocs-build.js.map +1 -1
  78. package/dist/components/verdocs-document-page2.js +1 -4
  79. package/dist/components/verdocs-document-page2.js.map +1 -1
  80. package/dist/components/verdocs-preview.js +16 -29
  81. package/dist/components/verdocs-preview.js.map +1 -1
  82. package/dist/components/verdocs-sign.js +100 -57
  83. package/dist/components/verdocs-sign.js.map +1 -1
  84. package/dist/components/verdocs-template-create2.js +29 -1
  85. package/dist/components/verdocs-template-create2.js.map +1 -1
  86. package/dist/components/verdocs-template-fields2.js +36 -67
  87. package/dist/components/verdocs-template-fields2.js.map +1 -1
  88. package/dist/components/verdocs-view.js +353 -1
  89. package/dist/components/verdocs-view.js.map +1 -1
  90. package/dist/docs.json +38 -568
  91. package/dist/esm/Envelopes-b031f847.js +93 -0
  92. package/dist/esm/Envelopes-b031f847.js.map +1 -0
  93. package/dist/esm/{Templates-91922342.js → Templates-1034fade.js} +2 -2
  94. package/dist/esm/{Templates-91922342.js.map → Templates-1034fade.js.map} +1 -1
  95. package/dist/esm/VerdocsEndpoint-dac04424.js +3566 -0
  96. package/dist/esm/VerdocsEndpoint-dac04424.js.map +1 -0
  97. package/dist/esm/{templateStore-3b26e38d.js → index-fd7b8a34.js} +2 -41
  98. package/dist/esm/index-fd7b8a34.js.map +1 -0
  99. package/dist/esm/loader.js +1 -1
  100. package/dist/esm/templateStore-96a39844.js +44 -0
  101. package/dist/esm/templateStore-96a39844.js.map +1 -0
  102. package/dist/esm/{utils-3f23facc.js → utils-99a3c1f0.js} +23 -4
  103. package/dist/esm/utils-99a3c1f0.js.map +1 -0
  104. package/dist/esm/verdocs-auth.entry.js +1 -1
  105. package/dist/esm/verdocs-build.entry.js +5 -4
  106. package/dist/esm/verdocs-build.entry.js.map +1 -1
  107. package/dist/esm/verdocs-contact-picker.entry.js +1 -1
  108. package/dist/esm/verdocs-document-page_2.entry.js +89 -0
  109. package/dist/esm/verdocs-document-page_2.entry.js.map +1 -0
  110. package/dist/esm/verdocs-dropdown_3.entry.js +1 -1
  111. package/dist/esm/verdocs-field-date.entry.js +1 -1
  112. package/dist/esm/verdocs-field-dropdown.entry.js +1 -1
  113. package/dist/esm/verdocs-field-initial.entry.js +1 -1
  114. package/dist/esm/verdocs-field-payment.entry.js +1 -1
  115. package/dist/esm/verdocs-field-signature_3.entry.js +1 -1
  116. package/dist/esm/verdocs-field-textarea.entry.js +1 -1
  117. package/dist/esm/verdocs-field-textbox.entry.js +3 -2
  118. package/dist/esm/verdocs-field-textbox.entry.js.map +1 -1
  119. package/dist/esm/verdocs-field-timestamp.entry.js +1 -1
  120. package/dist/esm/verdocs-preview.entry.js +17 -11
  121. package/dist/esm/verdocs-preview.entry.js.map +1 -1
  122. package/dist/esm/verdocs-quick-functions_3.entry.js +1 -1
  123. package/dist/esm/verdocs-search.entry.js +1 -1
  124. package/dist/esm/verdocs-send.entry.js +2 -2
  125. package/dist/esm/verdocs-sign.entry.js +92 -23
  126. package/dist/esm/verdocs-sign.entry.js.map +1 -1
  127. package/dist/esm/verdocs-template-create_4.entry.js +50 -34
  128. package/dist/esm/verdocs-template-create_4.entry.js.map +1 -1
  129. package/dist/esm/verdocs-view.entry.js +327 -0
  130. package/dist/esm/verdocs-view.entry.js.map +1 -0
  131. package/dist/esm/verdocs-web-sdk.js +1 -1
  132. package/dist/esm-es5/Envelopes-b031f847.js +2 -0
  133. package/dist/esm-es5/Envelopes-b031f847.js.map +1 -0
  134. package/dist/esm-es5/{Templates-91922342.js → Templates-1034fade.js} +2 -2
  135. package/dist/esm-es5/{Templates-91922342.js.map → Templates-1034fade.js.map} +0 -0
  136. package/dist/esm-es5/VerdocsEndpoint-dac04424.js +2 -0
  137. package/dist/esm-es5/VerdocsEndpoint-dac04424.js.map +1 -0
  138. package/dist/esm-es5/index-fd7b8a34.js +2 -0
  139. package/dist/esm-es5/index-fd7b8a34.js.map +1 -0
  140. package/dist/esm-es5/loader.js +1 -1
  141. package/dist/esm-es5/loader.js.map +1 -1
  142. package/dist/esm-es5/templateStore-96a39844.js +2 -0
  143. package/dist/esm-es5/templateStore-96a39844.js.map +1 -0
  144. package/dist/esm-es5/utils-99a3c1f0.js +2 -0
  145. package/dist/esm-es5/utils-99a3c1f0.js.map +1 -0
  146. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  147. package/dist/esm-es5/verdocs-build.entry.js +1 -1
  148. package/dist/esm-es5/verdocs-build.entry.js.map +1 -1
  149. package/dist/esm-es5/verdocs-contact-picker.entry.js +1 -1
  150. package/dist/esm-es5/verdocs-document-page_2.entry.js +2 -0
  151. package/dist/esm-es5/verdocs-document-page_2.entry.js.map +1 -0
  152. package/dist/esm-es5/verdocs-dropdown_3.entry.js +1 -1
  153. package/dist/esm-es5/verdocs-field-date.entry.js +1 -1
  154. package/dist/esm-es5/verdocs-field-dropdown.entry.js +1 -1
  155. package/dist/esm-es5/verdocs-field-initial.entry.js +1 -1
  156. package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
  157. package/dist/esm-es5/verdocs-field-signature_3.entry.js +1 -1
  158. package/dist/esm-es5/verdocs-field-textarea.entry.js +1 -1
  159. package/dist/esm-es5/verdocs-field-textbox.entry.js +1 -1
  160. package/dist/esm-es5/verdocs-field-textbox.entry.js.map +1 -1
  161. package/dist/esm-es5/verdocs-field-timestamp.entry.js +1 -1
  162. package/dist/esm-es5/verdocs-preview.entry.js +1 -1
  163. package/dist/esm-es5/verdocs-preview.entry.js.map +1 -1
  164. package/dist/esm-es5/verdocs-quick-functions_3.entry.js +1 -1
  165. package/dist/esm-es5/verdocs-search.entry.js +1 -1
  166. package/dist/esm-es5/verdocs-send.entry.js +1 -1
  167. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  168. package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
  169. package/dist/esm-es5/verdocs-template-create_4.entry.js +1 -1
  170. package/dist/esm-es5/verdocs-template-create_4.entry.js.map +1 -1
  171. package/dist/esm-es5/verdocs-view.entry.js +2 -0
  172. package/dist/esm-es5/verdocs-view.entry.js.map +1 -0
  173. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  174. package/dist/esm-es5/verdocs-web-sdk.js.map +1 -1
  175. package/dist/types/components/embeds/verdocs-preview/verdocs-preview.d.ts +3 -1
  176. package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +23 -8
  177. package/dist/types/components/embeds/verdocs-view/verdocs-view.d.ts +5 -40
  178. package/dist/types/components/embeds/verdocs-view/verdocs-view.stories.d.ts +1 -2
  179. package/dist/types/components.d.ts +6 -219
  180. package/dist/types/utils/Envelopes.d.ts +2 -0
  181. package/dist/types/utils/envelopeStore.d.ts +10 -0
  182. package/dist/types/utils/utils.d.ts +10 -2
  183. package/dist/verdocs-web-sdk/{p-ff4840d2.system.entry.js → p-0a2efec0.system.entry.js} +2 -2
  184. package/dist/verdocs-web-sdk/{p-ff4840d2.system.entry.js.map → p-0a2efec0.system.entry.js.map} +0 -0
  185. package/dist/verdocs-web-sdk/p-0a3d0ca9.js +2 -0
  186. package/dist/verdocs-web-sdk/{p-36700fe4.js.map → p-0a3d0ca9.js.map} +0 -0
  187. package/dist/verdocs-web-sdk/p-0f6da8c7.system.js +2 -0
  188. package/dist/verdocs-web-sdk/p-0f6da8c7.system.js.map +1 -0
  189. package/dist/verdocs-web-sdk/{p-d2d3b56d.system.entry.js → p-112c8e05.system.entry.js} +2 -2
  190. package/dist/verdocs-web-sdk/{p-d2d3b56d.system.entry.js.map → p-112c8e05.system.entry.js.map} +0 -0
  191. package/dist/verdocs-web-sdk/p-1cd2f7dc.system.js +2 -0
  192. package/dist/verdocs-web-sdk/p-1cd2f7dc.system.js.map +1 -0
  193. package/dist/verdocs-web-sdk/p-21ec6ff0.system.js +2 -0
  194. package/dist/verdocs-web-sdk/p-21ec6ff0.system.js.map +1 -0
  195. package/dist/verdocs-web-sdk/p-2cf3843a.entry.js +2 -0
  196. package/dist/verdocs-web-sdk/{p-e47e3154.entry.js.map → p-2cf3843a.entry.js.map} +1 -1
  197. package/dist/verdocs-web-sdk/{p-f11b14a1.entry.js → p-2fe5b678.entry.js} +2 -2
  198. package/dist/verdocs-web-sdk/{p-f11b14a1.entry.js.map → p-2fe5b678.entry.js.map} +0 -0
  199. package/dist/verdocs-web-sdk/p-30424967.entry.js +2 -0
  200. package/dist/verdocs-web-sdk/p-30424967.entry.js.map +1 -0
  201. package/dist/verdocs-web-sdk/p-32c7bce8.system.entry.js +2 -0
  202. package/dist/verdocs-web-sdk/p-32c7bce8.system.entry.js.map +1 -0
  203. package/dist/verdocs-web-sdk/{p-63d01d16.system.js → p-32da34af.system.js} +2 -2
  204. package/dist/verdocs-web-sdk/{p-63d01d16.system.js.map → p-32da34af.system.js.map} +0 -0
  205. package/dist/verdocs-web-sdk/{p-2510c268.entry.js → p-32e3a428.entry.js} +2 -2
  206. package/dist/verdocs-web-sdk/{p-2510c268.entry.js.map → p-32e3a428.entry.js.map} +0 -0
  207. package/dist/verdocs-web-sdk/{p-f5eb353f.system.entry.js → p-3585534a.system.entry.js} +2 -2
  208. package/dist/verdocs-web-sdk/{p-f5eb353f.system.entry.js.map → p-3585534a.system.entry.js.map} +0 -0
  209. package/dist/verdocs-web-sdk/{p-c37ea778.system.entry.js → p-35fec075.system.entry.js} +2 -2
  210. package/dist/verdocs-web-sdk/{p-c37ea778.system.entry.js.map → p-35fec075.system.entry.js.map} +0 -0
  211. package/dist/verdocs-web-sdk/{p-ab23a9d1.entry.js → p-4b4c610f.entry.js} +2 -2
  212. package/dist/verdocs-web-sdk/{p-ab23a9d1.entry.js.map → p-4b4c610f.entry.js.map} +0 -0
  213. package/dist/verdocs-web-sdk/{p-8c549b7f.entry.js → p-5b636344.entry.js} +2 -2
  214. package/dist/verdocs-web-sdk/{p-8c549b7f.entry.js.map → p-5b636344.entry.js.map} +0 -0
  215. package/dist/verdocs-web-sdk/p-5bb42252.system.entry.js +2 -0
  216. package/dist/verdocs-web-sdk/{p-508192bb.system.entry.js.map → p-5bb42252.system.entry.js.map} +1 -1
  217. package/dist/verdocs-web-sdk/p-5d341c89.system.entry.js +2 -0
  218. package/dist/verdocs-web-sdk/p-5d341c89.system.entry.js.map +1 -0
  219. package/dist/verdocs-web-sdk/p-5ea05a1d.js +2 -0
  220. package/dist/verdocs-web-sdk/p-5ea05a1d.js.map +1 -0
  221. package/dist/verdocs-web-sdk/p-6802bdd2.system.entry.js +2 -0
  222. package/dist/verdocs-web-sdk/{p-ccf983c7.system.entry.js.map → p-6802bdd2.system.entry.js.map} +1 -1
  223. package/dist/verdocs-web-sdk/{p-dee9037d.system.entry.js → p-6a8ac53e.system.entry.js} +2 -2
  224. package/dist/verdocs-web-sdk/{p-dee9037d.system.entry.js.map → p-6a8ac53e.system.entry.js.map} +0 -0
  225. package/dist/verdocs-web-sdk/{p-2bb98709.system.entry.js → p-78ec7db1.system.entry.js} +2 -2
  226. package/dist/verdocs-web-sdk/{p-2bb98709.system.entry.js.map → p-78ec7db1.system.entry.js.map} +0 -0
  227. package/dist/verdocs-web-sdk/{p-04708900.system.entry.js → p-8095fab3.system.entry.js} +2 -2
  228. package/dist/verdocs-web-sdk/{p-04708900.system.entry.js.map → p-8095fab3.system.entry.js.map} +0 -0
  229. package/dist/verdocs-web-sdk/{p-036fc9f9.entry.js → p-868f497f.entry.js} +2 -2
  230. package/dist/verdocs-web-sdk/{p-036fc9f9.entry.js.map → p-868f497f.entry.js.map} +0 -0
  231. package/dist/verdocs-web-sdk/p-9236d9df.entry.js +2 -0
  232. package/dist/verdocs-web-sdk/{p-f06218ed.entry.js.map → p-9236d9df.entry.js.map} +1 -1
  233. package/dist/verdocs-web-sdk/p-92b0fc42.js +2 -0
  234. package/dist/verdocs-web-sdk/p-92b0fc42.js.map +1 -0
  235. package/dist/verdocs-web-sdk/{p-d6390915.entry.js → p-a59f1f82.entry.js} +2 -2
  236. package/dist/verdocs-web-sdk/{p-d6390915.entry.js.map → p-a59f1f82.entry.js.map} +0 -0
  237. package/dist/verdocs-web-sdk/p-a760546b.entry.js +2 -0
  238. package/dist/verdocs-web-sdk/p-a760546b.entry.js.map +1 -0
  239. package/dist/verdocs-web-sdk/p-a7ac4da8.system.entry.js +2 -0
  240. package/dist/verdocs-web-sdk/p-a7ac4da8.system.entry.js.map +1 -0
  241. package/dist/verdocs-web-sdk/{p-8574c48b.system.entry.js → p-a8c25a4a.system.entry.js} +2 -2
  242. package/dist/verdocs-web-sdk/{p-8574c48b.system.entry.js.map → p-a8c25a4a.system.entry.js.map} +0 -0
  243. package/dist/verdocs-web-sdk/{p-bcae2278.entry.js → p-a9068845.entry.js} +2 -2
  244. package/dist/verdocs-web-sdk/{p-bcae2278.entry.js.map → p-a9068845.entry.js.map} +0 -0
  245. package/dist/verdocs-web-sdk/{p-0d12be64.system.entry.js → p-aa2d9932.system.entry.js} +2 -2
  246. package/dist/verdocs-web-sdk/{p-0d12be64.system.entry.js.map → p-aa2d9932.system.entry.js.map} +0 -0
  247. package/dist/verdocs-web-sdk/{p-ffff808d.entry.js → p-af1063e3.entry.js} +2 -2
  248. package/dist/verdocs-web-sdk/{p-ffff808d.entry.js.map → p-af1063e3.entry.js.map} +0 -0
  249. package/dist/verdocs-web-sdk/{p-cf8ecaaf.system.entry.js → p-b5882803.system.entry.js} +2 -2
  250. package/dist/verdocs-web-sdk/{p-cf8ecaaf.system.entry.js.map → p-b5882803.system.entry.js.map} +0 -0
  251. package/dist/verdocs-web-sdk/{p-68319ca5.system.entry.js → p-b6c24f97.system.entry.js} +2 -2
  252. package/dist/verdocs-web-sdk/{p-68319ca5.system.entry.js.map → p-b6c24f97.system.entry.js.map} +0 -0
  253. package/dist/verdocs-web-sdk/{p-2da21c85.entry.js → p-baa985a4.entry.js} +2 -2
  254. package/dist/verdocs-web-sdk/{p-2da21c85.entry.js.map → p-baa985a4.entry.js.map} +0 -0
  255. package/dist/verdocs-web-sdk/{p-650e0b71.entry.js → p-be8004c0.entry.js} +2 -2
  256. package/dist/verdocs-web-sdk/{p-650e0b71.entry.js.map → p-be8004c0.entry.js.map} +0 -0
  257. package/dist/verdocs-web-sdk/p-becd8d7e.js +2 -0
  258. package/dist/verdocs-web-sdk/p-becd8d7e.js.map +1 -0
  259. package/dist/verdocs-web-sdk/p-c16b6ca4.system.js +1 -1
  260. package/dist/verdocs-web-sdk/p-c16b6ca4.system.js.map +1 -1
  261. package/dist/verdocs-web-sdk/p-c4357387.entry.js +2 -0
  262. package/dist/verdocs-web-sdk/p-c4357387.entry.js.map +1 -0
  263. package/dist/verdocs-web-sdk/{p-6f1440dd.js → p-c5a43bb3.js} +2 -2
  264. package/dist/verdocs-web-sdk/p-c5a43bb3.js.map +1 -0
  265. package/dist/verdocs-web-sdk/p-cb7d9ff5.js +2 -0
  266. package/dist/verdocs-web-sdk/p-cb7d9ff5.js.map +1 -0
  267. package/dist/verdocs-web-sdk/{p-f9901184.system.js → p-cd7b475a.system.js} +2 -2
  268. package/dist/verdocs-web-sdk/p-cd7b475a.system.js.map +1 -0
  269. package/dist/verdocs-web-sdk/p-d1a97a03.system.js +2 -0
  270. package/dist/verdocs-web-sdk/p-d1a97a03.system.js.map +1 -0
  271. package/dist/verdocs-web-sdk/{p-473165ae.system.entry.js → p-dd864f36.system.entry.js} +2 -2
  272. package/dist/verdocs-web-sdk/{p-473165ae.system.entry.js.map → p-dd864f36.system.entry.js.map} +0 -0
  273. package/dist/verdocs-web-sdk/p-e4569806.system.entry.js +2 -0
  274. package/dist/verdocs-web-sdk/p-e4569806.system.entry.js.map +1 -0
  275. package/dist/verdocs-web-sdk/p-e4fa4969.entry.js +2 -0
  276. package/dist/verdocs-web-sdk/p-e4fa4969.entry.js.map +1 -0
  277. package/dist/verdocs-web-sdk/{p-932571a1.entry.js → p-f19e600e.entry.js} +2 -2
  278. package/dist/verdocs-web-sdk/{p-932571a1.entry.js.map → p-f19e600e.entry.js.map} +0 -0
  279. package/dist/verdocs-web-sdk/p-f8c49765.system.entry.js +2 -0
  280. package/dist/verdocs-web-sdk/p-f8c49765.system.entry.js.map +1 -0
  281. package/dist/verdocs-web-sdk/{p-6f938ce3.entry.js → p-f9a9b3a2.entry.js} +2 -2
  282. package/dist/verdocs-web-sdk/{p-6f938ce3.entry.js.map → p-f9a9b3a2.entry.js.map} +0 -0
  283. package/dist/verdocs-web-sdk/{p-259fd8de.entry.js → p-fac05414.entry.js} +2 -2
  284. package/dist/verdocs-web-sdk/{p-259fd8de.entry.js.map → p-fac05414.entry.js.map} +0 -0
  285. package/dist/verdocs-web-sdk/p-fc93f2f3.entry.js +2 -0
  286. package/dist/verdocs-web-sdk/p-fc93f2f3.entry.js.map +1 -0
  287. package/dist/verdocs-web-sdk/{p-ed8e3256.system.entry.js → p-ff0b44f9.system.entry.js} +2 -2
  288. package/dist/verdocs-web-sdk/{p-ed8e3256.system.entry.js.map → p-ff0b44f9.system.entry.js.map} +0 -0
  289. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  290. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js.map +1 -1
  291. package/package.json +2 -2
  292. package/dist/cjs/Envelopes-22a0c02f.js.map +0 -1
  293. package/dist/cjs/TemplateDocuments-01c6e570.js +0 -45
  294. package/dist/cjs/TemplateDocuments-01c6e570.js.map +0 -1
  295. package/dist/cjs/VerdocsEndpoint-db38e942.js +0 -2435
  296. package/dist/cjs/VerdocsEndpoint-db38e942.js.map +0 -1
  297. package/dist/cjs/templateStore-92828c3c.js.map +0 -1
  298. package/dist/cjs/utils-84236321.js.map +0 -1
  299. package/dist/cjs/verdocs-document-page.cjs.entry.js +0 -84
  300. package/dist/cjs/verdocs-document-page.cjs.entry.js.map +0 -1
  301. package/dist/cjs/verdocs-loader_4.cjs.entry.js +0 -553
  302. package/dist/cjs/verdocs-loader_4.cjs.entry.js.map +0 -1
  303. package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.css +0 -16
  304. package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.js +0 -390
  305. package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.js.map +0 -1
  306. package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.stories.js +0 -15
  307. package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.stories.js.map +0 -1
  308. package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.css +0 -16
  309. package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.js +0 -388
  310. package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.js.map +0 -1
  311. package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.stories.js +0 -15
  312. package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.stories.js.map +0 -1
  313. package/dist/components/TemplateDocuments.js +0 -42
  314. package/dist/components/TemplateDocuments.js.map +0 -1
  315. package/dist/components/verdocs-view-envelope-document.d.ts +0 -11
  316. package/dist/components/verdocs-view-envelope-document.js +0 -8
  317. package/dist/components/verdocs-view-envelope-document.js.map +0 -1
  318. package/dist/components/verdocs-view-envelope-document2.js +0 -306
  319. package/dist/components/verdocs-view-envelope-document2.js.map +0 -1
  320. package/dist/components/verdocs-view-template-document.d.ts +0 -11
  321. package/dist/components/verdocs-view-template-document.js +0 -8
  322. package/dist/components/verdocs-view-template-document.js.map +0 -1
  323. package/dist/components/verdocs-view-template-document2.js +0 -209
  324. package/dist/components/verdocs-view-template-document2.js.map +0 -1
  325. package/dist/components/verdocs-view2.js +0 -229
  326. package/dist/components/verdocs-view2.js.map +0 -1
  327. package/dist/esm/Envelopes-df05b3c7.js.map +0 -1
  328. package/dist/esm/TemplateDocuments-89ba2276.js +0 -42
  329. package/dist/esm/TemplateDocuments-89ba2276.js.map +0 -1
  330. package/dist/esm/VerdocsEndpoint-82f4600d.js +0 -2432
  331. package/dist/esm/VerdocsEndpoint-82f4600d.js.map +0 -1
  332. package/dist/esm/templateStore-3b26e38d.js.map +0 -1
  333. package/dist/esm/utils-3f23facc.js.map +0 -1
  334. package/dist/esm/verdocs-document-page.entry.js +0 -80
  335. package/dist/esm/verdocs-document-page.entry.js.map +0 -1
  336. package/dist/esm/verdocs-loader_4.entry.js +0 -546
  337. package/dist/esm/verdocs-loader_4.entry.js.map +0 -1
  338. package/dist/esm-es5/Envelopes-df05b3c7.js +0 -2
  339. package/dist/esm-es5/Envelopes-df05b3c7.js.map +0 -1
  340. package/dist/esm-es5/TemplateDocuments-89ba2276.js +0 -2
  341. package/dist/esm-es5/TemplateDocuments-89ba2276.js.map +0 -1
  342. package/dist/esm-es5/VerdocsEndpoint-82f4600d.js +0 -2
  343. package/dist/esm-es5/VerdocsEndpoint-82f4600d.js.map +0 -1
  344. package/dist/esm-es5/templateStore-3b26e38d.js +0 -2
  345. package/dist/esm-es5/templateStore-3b26e38d.js.map +0 -1
  346. package/dist/esm-es5/utils-3f23facc.js +0 -2
  347. package/dist/esm-es5/utils-3f23facc.js.map +0 -1
  348. package/dist/esm-es5/verdocs-document-page.entry.js +0 -2
  349. package/dist/esm-es5/verdocs-document-page.entry.js.map +0 -1
  350. package/dist/esm-es5/verdocs-loader_4.entry.js +0 -2
  351. package/dist/esm-es5/verdocs-loader_4.entry.js.map +0 -1
  352. package/dist/types/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.d.ts +0 -79
  353. package/dist/types/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.stories.d.ts +0 -7
  354. package/dist/types/components/elements/verdocs-view-template-document/verdocs-view-template-document.d.ts +0 -77
  355. package/dist/types/components/elements/verdocs-view-template-document/verdocs-view-template-document.stories.d.ts +0 -7
  356. package/dist/verdocs-web-sdk/p-142295dd.system.entry.js +0 -2
  357. package/dist/verdocs-web-sdk/p-142295dd.system.entry.js.map +0 -1
  358. package/dist/verdocs-web-sdk/p-2fbd4e25.entry.js +0 -2
  359. package/dist/verdocs-web-sdk/p-2fbd4e25.entry.js.map +0 -1
  360. package/dist/verdocs-web-sdk/p-3035b6c5.system.js +0 -2
  361. package/dist/verdocs-web-sdk/p-3035b6c5.system.js.map +0 -1
  362. package/dist/verdocs-web-sdk/p-36700fe4.js +0 -2
  363. package/dist/verdocs-web-sdk/p-3a4126d5.system.entry.js +0 -2
  364. package/dist/verdocs-web-sdk/p-3a4126d5.system.entry.js.map +0 -1
  365. package/dist/verdocs-web-sdk/p-48d9e0d6.entry.js +0 -2
  366. package/dist/verdocs-web-sdk/p-48d9e0d6.entry.js.map +0 -1
  367. package/dist/verdocs-web-sdk/p-508192bb.system.entry.js +0 -2
  368. package/dist/verdocs-web-sdk/p-629237fc.js +0 -2
  369. package/dist/verdocs-web-sdk/p-629237fc.js.map +0 -1
  370. package/dist/verdocs-web-sdk/p-6e1ada33.system.js +0 -2
  371. package/dist/verdocs-web-sdk/p-6e1ada33.system.js.map +0 -1
  372. package/dist/verdocs-web-sdk/p-6f1440dd.js.map +0 -1
  373. package/dist/verdocs-web-sdk/p-70c732b7.js +0 -2
  374. package/dist/verdocs-web-sdk/p-70c732b7.js.map +0 -1
  375. package/dist/verdocs-web-sdk/p-7ce27ce2.js +0 -2
  376. package/dist/verdocs-web-sdk/p-7ce27ce2.js.map +0 -1
  377. package/dist/verdocs-web-sdk/p-8fd9dc5a.js +0 -2
  378. package/dist/verdocs-web-sdk/p-8fd9dc5a.js.map +0 -1
  379. package/dist/verdocs-web-sdk/p-a4041773.system.js +0 -2
  380. package/dist/verdocs-web-sdk/p-a4041773.system.js.map +0 -1
  381. package/dist/verdocs-web-sdk/p-b348e0ee.entry.js +0 -2
  382. package/dist/verdocs-web-sdk/p-b348e0ee.entry.js.map +0 -1
  383. package/dist/verdocs-web-sdk/p-b95cb372.entry.js +0 -2
  384. package/dist/verdocs-web-sdk/p-b95cb372.entry.js.map +0 -1
  385. package/dist/verdocs-web-sdk/p-c827cc19.system.js +0 -2
  386. package/dist/verdocs-web-sdk/p-c827cc19.system.js.map +0 -1
  387. package/dist/verdocs-web-sdk/p-ca6a1398.system.entry.js +0 -2
  388. package/dist/verdocs-web-sdk/p-ca6a1398.system.entry.js.map +0 -1
  389. package/dist/verdocs-web-sdk/p-ccf983c7.system.entry.js +0 -2
  390. package/dist/verdocs-web-sdk/p-cf2d7761.system.entry.js +0 -2
  391. package/dist/verdocs-web-sdk/p-cf2d7761.system.entry.js.map +0 -1
  392. package/dist/verdocs-web-sdk/p-e47e3154.entry.js +0 -2
  393. package/dist/verdocs-web-sdk/p-f06218ed.entry.js +0 -2
  394. package/dist/verdocs-web-sdk/p-f9901184.system.js.map +0 -1
  395. package/dist/verdocs-web-sdk/p-fc3a0e2d.system.entry.js +0 -2
  396. package/dist/verdocs-web-sdk/p-fc3a0e2d.system.entry.js.map +0 -1
  397. package/dist/verdocs-web-sdk/p-fe512c19.entry.js +0 -2
  398. package/dist/verdocs-web-sdk/p-fe512c19.entry.js.map +0 -1
@@ -1,2432 +0,0 @@
1
- /* tslint:disable:no-bitwise */
2
- var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
3
- // Regular expression to check formal correctness of base64 encoded strings
4
- var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
5
- /**
6
- * Simplified, Node/Browser-safe alternative to atob() for base64 decoding.
7
- * Modified from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
8
- */
9
- var AtoB = function (str) {
10
- // atob can work with strings with whitespaces, even inside the encoded part,
11
- // but only \t, \n, \f, \r and ' ', which can be stripped.
12
- str = String(str).replace(/[\t\n\f\r ]+/g, '');
13
- if (!b64re.test(str))
14
- throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
15
- // Adding the padding if missing, for semplicity
16
- str += '=='.slice(2 - (str.length & 3));
17
- var bitmap;
18
- var result = '';
19
- var r1;
20
- var r2;
21
- var i = 0;
22
- for (; i < str.length;) {
23
- bitmap =
24
- (b64.indexOf(str.charAt(i++)) << 18) |
25
- (b64.indexOf(str.charAt(i++)) << 12) |
26
- ((r1 = b64.indexOf(str.charAt(i++))) << 6) |
27
- (r2 = b64.indexOf(str.charAt(i++)));
28
- result +=
29
- r1 === 64
30
- ? String.fromCharCode((bitmap >> 16) & 255)
31
- : r2 === 64
32
- ? String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255)
33
- : String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255, bitmap & 255);
34
- }
35
- return result;
36
- };
37
- /**
38
- * Decode the body of a JWT. This helper may allow front-end applications to avoid a dependency on `jsonwebtoken` in
39
- * many cases. Note that this should only be used for true JWTs. Opaque tokens will cause this to throw.
40
- */
41
- var decodeJWTBody = function (token) { return JSON.parse(AtoB((token || '').split('.')[1] || '')); };
42
- /**
43
- * Decode the body of an Verdocs access token. Note that raw tokens contain namespaced fields, e.g.
44
- * `https://verdocs.com/profile_id`. To make these tokens easier to use in front-end code, this name-spacing
45
- * will be removed. Note that user and signing sessions have different access token formats. The calling
46
- * application should distinguish between the two based on the context of the authenticated session, or by
47
- * the presence of the `document_id` field, which will only be present for signing sessions.
48
- */
49
- var decodeAccessTokenBody = function (token) {
50
- var decoded;
51
- try {
52
- decoded = decodeJWTBody(token);
53
- if (decoded === null) {
54
- return null;
55
- }
56
- }
57
- catch (e) {
58
- return null;
59
- }
60
- Object.keys(decoded).forEach(function (key) {
61
- if (typeof key === 'string' && key.startsWith('https://verdocs.com/')) {
62
- decoded[key.replace('https://verdocs.com/', '')] = decoded[key];
63
- delete decoded[key];
64
- }
65
- });
66
- return decoded;
67
- };
68
-
69
- var bind = function bind(fn, thisArg) {
70
- return function wrap() {
71
- var args = new Array(arguments.length);
72
- for (var i = 0; i < args.length; i++) {
73
- args[i] = arguments[i];
74
- }
75
- return fn.apply(thisArg, args);
76
- };
77
- };
78
-
79
- // utils is a library of generic helper functions non-specific to axios
80
-
81
- var toString = Object.prototype.toString;
82
-
83
- // eslint-disable-next-line func-names
84
- var kindOf = (function(cache) {
85
- // eslint-disable-next-line func-names
86
- return function(thing) {
87
- var str = toString.call(thing);
88
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
89
- };
90
- })(Object.create(null));
91
-
92
- function kindOfTest(type) {
93
- type = type.toLowerCase();
94
- return function isKindOf(thing) {
95
- return kindOf(thing) === type;
96
- };
97
- }
98
-
99
- /**
100
- * Determine if a value is an Array
101
- *
102
- * @param {Object} val The value to test
103
- * @returns {boolean} True if value is an Array, otherwise false
104
- */
105
- function isArray(val) {
106
- return Array.isArray(val);
107
- }
108
-
109
- /**
110
- * Determine if a value is undefined
111
- *
112
- * @param {Object} val The value to test
113
- * @returns {boolean} True if the value is undefined, otherwise false
114
- */
115
- function isUndefined(val) {
116
- return typeof val === 'undefined';
117
- }
118
-
119
- /**
120
- * Determine if a value is a Buffer
121
- *
122
- * @param {Object} val The value to test
123
- * @returns {boolean} True if value is a Buffer, otherwise false
124
- */
125
- function isBuffer(val) {
126
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
127
- && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
128
- }
129
-
130
- /**
131
- * Determine if a value is an ArrayBuffer
132
- *
133
- * @function
134
- * @param {Object} val The value to test
135
- * @returns {boolean} True if value is an ArrayBuffer, otherwise false
136
- */
137
- var isArrayBuffer = kindOfTest('ArrayBuffer');
138
-
139
-
140
- /**
141
- * Determine if a value is a view on an ArrayBuffer
142
- *
143
- * @param {Object} val The value to test
144
- * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
145
- */
146
- function isArrayBufferView(val) {
147
- var result;
148
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
149
- result = ArrayBuffer.isView(val);
150
- } else {
151
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
152
- }
153
- return result;
154
- }
155
-
156
- /**
157
- * Determine if a value is a String
158
- *
159
- * @param {Object} val The value to test
160
- * @returns {boolean} True if value is a String, otherwise false
161
- */
162
- function isString(val) {
163
- return typeof val === 'string';
164
- }
165
-
166
- /**
167
- * Determine if a value is a Number
168
- *
169
- * @param {Object} val The value to test
170
- * @returns {boolean} True if value is a Number, otherwise false
171
- */
172
- function isNumber(val) {
173
- return typeof val === 'number';
174
- }
175
-
176
- /**
177
- * Determine if a value is an Object
178
- *
179
- * @param {Object} val The value to test
180
- * @returns {boolean} True if value is an Object, otherwise false
181
- */
182
- function isObject(val) {
183
- return val !== null && typeof val === 'object';
184
- }
185
-
186
- /**
187
- * Determine if a value is a plain Object
188
- *
189
- * @param {Object} val The value to test
190
- * @return {boolean} True if value is a plain Object, otherwise false
191
- */
192
- function isPlainObject(val) {
193
- if (kindOf(val) !== 'object') {
194
- return false;
195
- }
196
-
197
- var prototype = Object.getPrototypeOf(val);
198
- return prototype === null || prototype === Object.prototype;
199
- }
200
-
201
- /**
202
- * Determine if a value is a Date
203
- *
204
- * @function
205
- * @param {Object} val The value to test
206
- * @returns {boolean} True if value is a Date, otherwise false
207
- */
208
- var isDate = kindOfTest('Date');
209
-
210
- /**
211
- * Determine if a value is a File
212
- *
213
- * @function
214
- * @param {Object} val The value to test
215
- * @returns {boolean} True if value is a File, otherwise false
216
- */
217
- var isFile = kindOfTest('File');
218
-
219
- /**
220
- * Determine if a value is a Blob
221
- *
222
- * @function
223
- * @param {Object} val The value to test
224
- * @returns {boolean} True if value is a Blob, otherwise false
225
- */
226
- var isBlob = kindOfTest('Blob');
227
-
228
- /**
229
- * Determine if a value is a FileList
230
- *
231
- * @function
232
- * @param {Object} val The value to test
233
- * @returns {boolean} True if value is a File, otherwise false
234
- */
235
- var isFileList = kindOfTest('FileList');
236
-
237
- /**
238
- * Determine if a value is a Function
239
- *
240
- * @param {Object} val The value to test
241
- * @returns {boolean} True if value is a Function, otherwise false
242
- */
243
- function isFunction(val) {
244
- return toString.call(val) === '[object Function]';
245
- }
246
-
247
- /**
248
- * Determine if a value is a Stream
249
- *
250
- * @param {Object} val The value to test
251
- * @returns {boolean} True if value is a Stream, otherwise false
252
- */
253
- function isStream(val) {
254
- return isObject(val) && isFunction(val.pipe);
255
- }
256
-
257
- /**
258
- * Determine if a value is a FormData
259
- *
260
- * @param {Object} thing The value to test
261
- * @returns {boolean} True if value is an FormData, otherwise false
262
- */
263
- function isFormData(thing) {
264
- var pattern = '[object FormData]';
265
- return thing && (
266
- (typeof FormData === 'function' && thing instanceof FormData) ||
267
- toString.call(thing) === pattern ||
268
- (isFunction(thing.toString) && thing.toString() === pattern)
269
- );
270
- }
271
-
272
- /**
273
- * Determine if a value is a URLSearchParams object
274
- * @function
275
- * @param {Object} val The value to test
276
- * @returns {boolean} True if value is a URLSearchParams object, otherwise false
277
- */
278
- var isURLSearchParams = kindOfTest('URLSearchParams');
279
-
280
- /**
281
- * Trim excess whitespace off the beginning and end of a string
282
- *
283
- * @param {String} str The String to trim
284
- * @returns {String} The String freed of excess whitespace
285
- */
286
- function trim(str) {
287
- return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
288
- }
289
-
290
- /**
291
- * Determine if we're running in a standard browser environment
292
- *
293
- * This allows axios to run in a web worker, and react-native.
294
- * Both environments support XMLHttpRequest, but not fully standard globals.
295
- *
296
- * web workers:
297
- * typeof window -> undefined
298
- * typeof document -> undefined
299
- *
300
- * react-native:
301
- * navigator.product -> 'ReactNative'
302
- * nativescript
303
- * navigator.product -> 'NativeScript' or 'NS'
304
- */
305
- function isStandardBrowserEnv() {
306
- if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
307
- navigator.product === 'NativeScript' ||
308
- navigator.product === 'NS')) {
309
- return false;
310
- }
311
- return (
312
- typeof window !== 'undefined' &&
313
- typeof document !== 'undefined'
314
- );
315
- }
316
-
317
- /**
318
- * Iterate over an Array or an Object invoking a function for each item.
319
- *
320
- * If `obj` is an Array callback will be called passing
321
- * the value, index, and complete array for each item.
322
- *
323
- * If 'obj' is an Object callback will be called passing
324
- * the value, key, and complete object for each property.
325
- *
326
- * @param {Object|Array} obj The object to iterate
327
- * @param {Function} fn The callback to invoke for each item
328
- */
329
- function forEach(obj, fn) {
330
- // Don't bother if no value provided
331
- if (obj === null || typeof obj === 'undefined') {
332
- return;
333
- }
334
-
335
- // Force an array if not already something iterable
336
- if (typeof obj !== 'object') {
337
- /*eslint no-param-reassign:0*/
338
- obj = [obj];
339
- }
340
-
341
- if (isArray(obj)) {
342
- // Iterate over array values
343
- for (var i = 0, l = obj.length; i < l; i++) {
344
- fn.call(null, obj[i], i, obj);
345
- }
346
- } else {
347
- // Iterate over object keys
348
- for (var key in obj) {
349
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
350
- fn.call(null, obj[key], key, obj);
351
- }
352
- }
353
- }
354
- }
355
-
356
- /**
357
- * Accepts varargs expecting each argument to be an object, then
358
- * immutably merges the properties of each object and returns result.
359
- *
360
- * When multiple objects contain the same key the later object in
361
- * the arguments list will take precedence.
362
- *
363
- * Example:
364
- *
365
- * ```js
366
- * var result = merge({foo: 123}, {foo: 456});
367
- * console.log(result.foo); // outputs 456
368
- * ```
369
- *
370
- * @param {Object} obj1 Object to merge
371
- * @returns {Object} Result of all merge properties
372
- */
373
- function merge(/* obj1, obj2, obj3, ... */) {
374
- var result = {};
375
- function assignValue(val, key) {
376
- if (isPlainObject(result[key]) && isPlainObject(val)) {
377
- result[key] = merge(result[key], val);
378
- } else if (isPlainObject(val)) {
379
- result[key] = merge({}, val);
380
- } else if (isArray(val)) {
381
- result[key] = val.slice();
382
- } else {
383
- result[key] = val;
384
- }
385
- }
386
-
387
- for (var i = 0, l = arguments.length; i < l; i++) {
388
- forEach(arguments[i], assignValue);
389
- }
390
- return result;
391
- }
392
-
393
- /**
394
- * Extends object a by mutably adding to it the properties of object b.
395
- *
396
- * @param {Object} a The object to be extended
397
- * @param {Object} b The object to copy properties from
398
- * @param {Object} thisArg The object to bind function to
399
- * @return {Object} The resulting value of object a
400
- */
401
- function extend(a, b, thisArg) {
402
- forEach(b, function assignValue(val, key) {
403
- if (thisArg && typeof val === 'function') {
404
- a[key] = bind(val, thisArg);
405
- } else {
406
- a[key] = val;
407
- }
408
- });
409
- return a;
410
- }
411
-
412
- /**
413
- * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
414
- *
415
- * @param {string} content with BOM
416
- * @return {string} content value without BOM
417
- */
418
- function stripBOM(content) {
419
- if (content.charCodeAt(0) === 0xFEFF) {
420
- content = content.slice(1);
421
- }
422
- return content;
423
- }
424
-
425
- /**
426
- * Inherit the prototype methods from one constructor into another
427
- * @param {function} constructor
428
- * @param {function} superConstructor
429
- * @param {object} [props]
430
- * @param {object} [descriptors]
431
- */
432
-
433
- function inherits(constructor, superConstructor, props, descriptors) {
434
- constructor.prototype = Object.create(superConstructor.prototype, descriptors);
435
- constructor.prototype.constructor = constructor;
436
- props && Object.assign(constructor.prototype, props);
437
- }
438
-
439
- /**
440
- * Resolve object with deep prototype chain to a flat object
441
- * @param {Object} sourceObj source object
442
- * @param {Object} [destObj]
443
- * @param {Function} [filter]
444
- * @returns {Object}
445
- */
446
-
447
- function toFlatObject(sourceObj, destObj, filter) {
448
- var props;
449
- var i;
450
- var prop;
451
- var merged = {};
452
-
453
- destObj = destObj || {};
454
-
455
- do {
456
- props = Object.getOwnPropertyNames(sourceObj);
457
- i = props.length;
458
- while (i-- > 0) {
459
- prop = props[i];
460
- if (!merged[prop]) {
461
- destObj[prop] = sourceObj[prop];
462
- merged[prop] = true;
463
- }
464
- }
465
- sourceObj = Object.getPrototypeOf(sourceObj);
466
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
467
-
468
- return destObj;
469
- }
470
-
471
- /*
472
- * determines whether a string ends with the characters of a specified string
473
- * @param {String} str
474
- * @param {String} searchString
475
- * @param {Number} [position= 0]
476
- * @returns {boolean}
477
- */
478
- function endsWith(str, searchString, position) {
479
- str = String(str);
480
- if (position === undefined || position > str.length) {
481
- position = str.length;
482
- }
483
- position -= searchString.length;
484
- var lastIndex = str.indexOf(searchString, position);
485
- return lastIndex !== -1 && lastIndex === position;
486
- }
487
-
488
-
489
- /**
490
- * Returns new array from array like object
491
- * @param {*} [thing]
492
- * @returns {Array}
493
- */
494
- function toArray(thing) {
495
- if (!thing) return null;
496
- var i = thing.length;
497
- if (isUndefined(i)) return null;
498
- var arr = new Array(i);
499
- while (i-- > 0) {
500
- arr[i] = thing[i];
501
- }
502
- return arr;
503
- }
504
-
505
- // eslint-disable-next-line func-names
506
- var isTypedArray = (function(TypedArray) {
507
- // eslint-disable-next-line func-names
508
- return function(thing) {
509
- return TypedArray && thing instanceof TypedArray;
510
- };
511
- })(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
512
-
513
- var utils = {
514
- isArray: isArray,
515
- isArrayBuffer: isArrayBuffer,
516
- isBuffer: isBuffer,
517
- isFormData: isFormData,
518
- isArrayBufferView: isArrayBufferView,
519
- isString: isString,
520
- isNumber: isNumber,
521
- isObject: isObject,
522
- isPlainObject: isPlainObject,
523
- isUndefined: isUndefined,
524
- isDate: isDate,
525
- isFile: isFile,
526
- isBlob: isBlob,
527
- isFunction: isFunction,
528
- isStream: isStream,
529
- isURLSearchParams: isURLSearchParams,
530
- isStandardBrowserEnv: isStandardBrowserEnv,
531
- forEach: forEach,
532
- merge: merge,
533
- extend: extend,
534
- trim: trim,
535
- stripBOM: stripBOM,
536
- inherits: inherits,
537
- toFlatObject: toFlatObject,
538
- kindOf: kindOf,
539
- kindOfTest: kindOfTest,
540
- endsWith: endsWith,
541
- toArray: toArray,
542
- isTypedArray: isTypedArray,
543
- isFileList: isFileList
544
- };
545
-
546
- function encode(val) {
547
- return encodeURIComponent(val).
548
- replace(/%3A/gi, ':').
549
- replace(/%24/g, '$').
550
- replace(/%2C/gi, ',').
551
- replace(/%20/g, '+').
552
- replace(/%5B/gi, '[').
553
- replace(/%5D/gi, ']');
554
- }
555
-
556
- /**
557
- * Build a URL by appending params to the end
558
- *
559
- * @param {string} url The base of the url (e.g., http://www.google.com)
560
- * @param {object} [params] The params to be appended
561
- * @returns {string} The formatted url
562
- */
563
- var buildURL = function buildURL(url, params, paramsSerializer) {
564
- /*eslint no-param-reassign:0*/
565
- if (!params) {
566
- return url;
567
- }
568
-
569
- var serializedParams;
570
- if (paramsSerializer) {
571
- serializedParams = paramsSerializer(params);
572
- } else if (utils.isURLSearchParams(params)) {
573
- serializedParams = params.toString();
574
- } else {
575
- var parts = [];
576
-
577
- utils.forEach(params, function serialize(val, key) {
578
- if (val === null || typeof val === 'undefined') {
579
- return;
580
- }
581
-
582
- if (utils.isArray(val)) {
583
- key = key + '[]';
584
- } else {
585
- val = [val];
586
- }
587
-
588
- utils.forEach(val, function parseValue(v) {
589
- if (utils.isDate(v)) {
590
- v = v.toISOString();
591
- } else if (utils.isObject(v)) {
592
- v = JSON.stringify(v);
593
- }
594
- parts.push(encode(key) + '=' + encode(v));
595
- });
596
- });
597
-
598
- serializedParams = parts.join('&');
599
- }
600
-
601
- if (serializedParams) {
602
- var hashmarkIndex = url.indexOf('#');
603
- if (hashmarkIndex !== -1) {
604
- url = url.slice(0, hashmarkIndex);
605
- }
606
-
607
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
608
- }
609
-
610
- return url;
611
- };
612
-
613
- function InterceptorManager() {
614
- this.handlers = [];
615
- }
616
-
617
- /**
618
- * Add a new interceptor to the stack
619
- *
620
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
621
- * @param {Function} rejected The function to handle `reject` for a `Promise`
622
- *
623
- * @return {Number} An ID used to remove interceptor later
624
- */
625
- InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
626
- this.handlers.push({
627
- fulfilled: fulfilled,
628
- rejected: rejected,
629
- synchronous: options ? options.synchronous : false,
630
- runWhen: options ? options.runWhen : null
631
- });
632
- return this.handlers.length - 1;
633
- };
634
-
635
- /**
636
- * Remove an interceptor from the stack
637
- *
638
- * @param {Number} id The ID that was returned by `use`
639
- */
640
- InterceptorManager.prototype.eject = function eject(id) {
641
- if (this.handlers[id]) {
642
- this.handlers[id] = null;
643
- }
644
- };
645
-
646
- /**
647
- * Iterate over all the registered interceptors
648
- *
649
- * This method is particularly useful for skipping over any
650
- * interceptors that may have become `null` calling `eject`.
651
- *
652
- * @param {Function} fn The function to call for each interceptor
653
- */
654
- InterceptorManager.prototype.forEach = function forEach(fn) {
655
- utils.forEach(this.handlers, function forEachHandler(h) {
656
- if (h !== null) {
657
- fn(h);
658
- }
659
- });
660
- };
661
-
662
- var InterceptorManager_1 = InterceptorManager;
663
-
664
- var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
665
- utils.forEach(headers, function processHeader(value, name) {
666
- if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
667
- headers[normalizedName] = value;
668
- delete headers[name];
669
- }
670
- });
671
- };
672
-
673
- /**
674
- * Create an Error with the specified message, config, error code, request and response.
675
- *
676
- * @param {string} message The error message.
677
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
678
- * @param {Object} [config] The config.
679
- * @param {Object} [request] The request.
680
- * @param {Object} [response] The response.
681
- * @returns {Error} The created error.
682
- */
683
- function AxiosError(message, code, config, request, response) {
684
- Error.call(this);
685
- this.message = message;
686
- this.name = 'AxiosError';
687
- code && (this.code = code);
688
- config && (this.config = config);
689
- request && (this.request = request);
690
- response && (this.response = response);
691
- }
692
-
693
- utils.inherits(AxiosError, Error, {
694
- toJSON: function toJSON() {
695
- return {
696
- // Standard
697
- message: this.message,
698
- name: this.name,
699
- // Microsoft
700
- description: this.description,
701
- number: this.number,
702
- // Mozilla
703
- fileName: this.fileName,
704
- lineNumber: this.lineNumber,
705
- columnNumber: this.columnNumber,
706
- stack: this.stack,
707
- // Axios
708
- config: this.config,
709
- code: this.code,
710
- status: this.response && this.response.status ? this.response.status : null
711
- };
712
- }
713
- });
714
-
715
- var prototype = AxiosError.prototype;
716
- var descriptors = {};
717
-
718
- [
719
- 'ERR_BAD_OPTION_VALUE',
720
- 'ERR_BAD_OPTION',
721
- 'ECONNABORTED',
722
- 'ETIMEDOUT',
723
- 'ERR_NETWORK',
724
- 'ERR_FR_TOO_MANY_REDIRECTS',
725
- 'ERR_DEPRECATED',
726
- 'ERR_BAD_RESPONSE',
727
- 'ERR_BAD_REQUEST',
728
- 'ERR_CANCELED'
729
- // eslint-disable-next-line func-names
730
- ].forEach(function(code) {
731
- descriptors[code] = {value: code};
732
- });
733
-
734
- Object.defineProperties(AxiosError, descriptors);
735
- Object.defineProperty(prototype, 'isAxiosError', {value: true});
736
-
737
- // eslint-disable-next-line func-names
738
- AxiosError.from = function(error, code, config, request, response, customProps) {
739
- var axiosError = Object.create(prototype);
740
-
741
- utils.toFlatObject(error, axiosError, function filter(obj) {
742
- return obj !== Error.prototype;
743
- });
744
-
745
- AxiosError.call(axiosError, error.message, code, config, request, response);
746
-
747
- axiosError.name = error.name;
748
-
749
- customProps && Object.assign(axiosError, customProps);
750
-
751
- return axiosError;
752
- };
753
-
754
- var AxiosError_1 = AxiosError;
755
-
756
- var transitional = {
757
- silentJSONParsing: true,
758
- forcedJSONParsing: true,
759
- clarifyTimeoutError: false
760
- };
761
-
762
- /**
763
- * Convert a data object to FormData
764
- * @param {Object} obj
765
- * @param {?Object} [formData]
766
- * @returns {Object}
767
- **/
768
-
769
- function toFormData(obj, formData) {
770
- // eslint-disable-next-line no-param-reassign
771
- formData = formData || new FormData();
772
-
773
- var stack = [];
774
-
775
- function convertValue(value) {
776
- if (value === null) return '';
777
-
778
- if (utils.isDate(value)) {
779
- return value.toISOString();
780
- }
781
-
782
- if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
783
- return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
784
- }
785
-
786
- return value;
787
- }
788
-
789
- function build(data, parentKey) {
790
- if (utils.isPlainObject(data) || utils.isArray(data)) {
791
- if (stack.indexOf(data) !== -1) {
792
- throw Error('Circular reference detected in ' + parentKey);
793
- }
794
-
795
- stack.push(data);
796
-
797
- utils.forEach(data, function each(value, key) {
798
- if (utils.isUndefined(value)) return;
799
- var fullKey = parentKey ? parentKey + '.' + key : key;
800
- var arr;
801
-
802
- if (value && !parentKey && typeof value === 'object') {
803
- if (utils.endsWith(key, '{}')) {
804
- // eslint-disable-next-line no-param-reassign
805
- value = JSON.stringify(value);
806
- } else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
807
- // eslint-disable-next-line func-names
808
- arr.forEach(function(el) {
809
- !utils.isUndefined(el) && formData.append(fullKey, convertValue(el));
810
- });
811
- return;
812
- }
813
- }
814
-
815
- build(value, fullKey);
816
- });
817
-
818
- stack.pop();
819
- } else {
820
- formData.append(parentKey, convertValue(data));
821
- }
822
- }
823
-
824
- build(obj);
825
-
826
- return formData;
827
- }
828
-
829
- var toFormData_1 = toFormData;
830
-
831
- /**
832
- * Resolve or reject a Promise based on response status.
833
- *
834
- * @param {Function} resolve A function that resolves the promise.
835
- * @param {Function} reject A function that rejects the promise.
836
- * @param {object} response The response.
837
- */
838
- var settle = function settle(resolve, reject, response) {
839
- var validateStatus = response.config.validateStatus;
840
- if (!response.status || !validateStatus || validateStatus(response.status)) {
841
- resolve(response);
842
- } else {
843
- reject(new AxiosError_1(
844
- 'Request failed with status code ' + response.status,
845
- [AxiosError_1.ERR_BAD_REQUEST, AxiosError_1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
846
- response.config,
847
- response.request,
848
- response
849
- ));
850
- }
851
- };
852
-
853
- var cookies = (
854
- utils.isStandardBrowserEnv() ?
855
-
856
- // Standard browser envs support document.cookie
857
- (function standardBrowserEnv() {
858
- return {
859
- write: function write(name, value, expires, path, domain, secure) {
860
- var cookie = [];
861
- cookie.push(name + '=' + encodeURIComponent(value));
862
-
863
- if (utils.isNumber(expires)) {
864
- cookie.push('expires=' + new Date(expires).toGMTString());
865
- }
866
-
867
- if (utils.isString(path)) {
868
- cookie.push('path=' + path);
869
- }
870
-
871
- if (utils.isString(domain)) {
872
- cookie.push('domain=' + domain);
873
- }
874
-
875
- if (secure === true) {
876
- cookie.push('secure');
877
- }
878
-
879
- document.cookie = cookie.join('; ');
880
- },
881
-
882
- read: function read(name) {
883
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
884
- return (match ? decodeURIComponent(match[3]) : null);
885
- },
886
-
887
- remove: function remove(name) {
888
- this.write(name, '', Date.now() - 86400000);
889
- }
890
- };
891
- })() :
892
-
893
- // Non standard browser env (web workers, react-native) lack needed support.
894
- (function nonStandardBrowserEnv() {
895
- return {
896
- write: function write() {},
897
- read: function read() { return null; },
898
- remove: function remove() {}
899
- };
900
- })()
901
- );
902
-
903
- /**
904
- * Determines whether the specified URL is absolute
905
- *
906
- * @param {string} url The URL to test
907
- * @returns {boolean} True if the specified URL is absolute, otherwise false
908
- */
909
- var isAbsoluteURL = function isAbsoluteURL(url) {
910
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
911
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
912
- // by any combination of letters, digits, plus, period, or hyphen.
913
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
914
- };
915
-
916
- /**
917
- * Creates a new URL by combining the specified URLs
918
- *
919
- * @param {string} baseURL The base URL
920
- * @param {string} relativeURL The relative URL
921
- * @returns {string} The combined URL
922
- */
923
- var combineURLs = function combineURLs(baseURL, relativeURL) {
924
- return relativeURL
925
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
926
- : baseURL;
927
- };
928
-
929
- /**
930
- * Creates a new URL by combining the baseURL with the requestedURL,
931
- * only when the requestedURL is not already an absolute URL.
932
- * If the requestURL is absolute, this function returns the requestedURL untouched.
933
- *
934
- * @param {string} baseURL The base URL
935
- * @param {string} requestedURL Absolute or relative URL to combine
936
- * @returns {string} The combined full path
937
- */
938
- var buildFullPath = function buildFullPath(baseURL, requestedURL) {
939
- if (baseURL && !isAbsoluteURL(requestedURL)) {
940
- return combineURLs(baseURL, requestedURL);
941
- }
942
- return requestedURL;
943
- };
944
-
945
- // Headers whose duplicates are ignored by node
946
- // c.f. https://nodejs.org/api/http.html#http_message_headers
947
- var ignoreDuplicateOf = [
948
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
949
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
950
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
951
- 'referer', 'retry-after', 'user-agent'
952
- ];
953
-
954
- /**
955
- * Parse headers into an object
956
- *
957
- * ```
958
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
959
- * Content-Type: application/json
960
- * Connection: keep-alive
961
- * Transfer-Encoding: chunked
962
- * ```
963
- *
964
- * @param {String} headers Headers needing to be parsed
965
- * @returns {Object} Headers parsed into an object
966
- */
967
- var parseHeaders = function parseHeaders(headers) {
968
- var parsed = {};
969
- var key;
970
- var val;
971
- var i;
972
-
973
- if (!headers) { return parsed; }
974
-
975
- utils.forEach(headers.split('\n'), function parser(line) {
976
- i = line.indexOf(':');
977
- key = utils.trim(line.substr(0, i)).toLowerCase();
978
- val = utils.trim(line.substr(i + 1));
979
-
980
- if (key) {
981
- if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
982
- return;
983
- }
984
- if (key === 'set-cookie') {
985
- parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
986
- } else {
987
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
988
- }
989
- }
990
- });
991
-
992
- return parsed;
993
- };
994
-
995
- var isURLSameOrigin = (
996
- utils.isStandardBrowserEnv() ?
997
-
998
- // Standard browser envs have full support of the APIs needed to test
999
- // whether the request URL is of the same origin as current location.
1000
- (function standardBrowserEnv() {
1001
- var msie = /(msie|trident)/i.test(navigator.userAgent);
1002
- var urlParsingNode = document.createElement('a');
1003
- var originURL;
1004
-
1005
- /**
1006
- * Parse a URL to discover it's components
1007
- *
1008
- * @param {String} url The URL to be parsed
1009
- * @returns {Object}
1010
- */
1011
- function resolveURL(url) {
1012
- var href = url;
1013
-
1014
- if (msie) {
1015
- // IE needs attribute set twice to normalize properties
1016
- urlParsingNode.setAttribute('href', href);
1017
- href = urlParsingNode.href;
1018
- }
1019
-
1020
- urlParsingNode.setAttribute('href', href);
1021
-
1022
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
1023
- return {
1024
- href: urlParsingNode.href,
1025
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
1026
- host: urlParsingNode.host,
1027
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
1028
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
1029
- hostname: urlParsingNode.hostname,
1030
- port: urlParsingNode.port,
1031
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
1032
- urlParsingNode.pathname :
1033
- '/' + urlParsingNode.pathname
1034
- };
1035
- }
1036
-
1037
- originURL = resolveURL(window.location.href);
1038
-
1039
- /**
1040
- * Determine if a URL shares the same origin as the current location
1041
- *
1042
- * @param {String} requestURL The URL to test
1043
- * @returns {boolean} True if URL shares the same origin, otherwise false
1044
- */
1045
- return function isURLSameOrigin(requestURL) {
1046
- var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
1047
- return (parsed.protocol === originURL.protocol &&
1048
- parsed.host === originURL.host);
1049
- };
1050
- })() :
1051
-
1052
- // Non standard browser envs (web workers, react-native) lack needed support.
1053
- (function nonStandardBrowserEnv() {
1054
- return function isURLSameOrigin() {
1055
- return true;
1056
- };
1057
- })()
1058
- );
1059
-
1060
- /**
1061
- * A `CanceledError` is an object that is thrown when an operation is canceled.
1062
- *
1063
- * @class
1064
- * @param {string=} message The message.
1065
- */
1066
- function CanceledError(message) {
1067
- // eslint-disable-next-line no-eq-null,eqeqeq
1068
- AxiosError_1.call(this, message == null ? 'canceled' : message, AxiosError_1.ERR_CANCELED);
1069
- this.name = 'CanceledError';
1070
- }
1071
-
1072
- utils.inherits(CanceledError, AxiosError_1, {
1073
- __CANCEL__: true
1074
- });
1075
-
1076
- var CanceledError_1 = CanceledError;
1077
-
1078
- var parseProtocol = function parseProtocol(url) {
1079
- var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1080
- return match && match[1] || '';
1081
- };
1082
-
1083
- var xhr = function xhrAdapter(config) {
1084
- return new Promise(function dispatchXhrRequest(resolve, reject) {
1085
- var requestData = config.data;
1086
- var requestHeaders = config.headers;
1087
- var responseType = config.responseType;
1088
- var onCanceled;
1089
- function done() {
1090
- if (config.cancelToken) {
1091
- config.cancelToken.unsubscribe(onCanceled);
1092
- }
1093
-
1094
- if (config.signal) {
1095
- config.signal.removeEventListener('abort', onCanceled);
1096
- }
1097
- }
1098
-
1099
- if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) {
1100
- delete requestHeaders['Content-Type']; // Let the browser set it
1101
- }
1102
-
1103
- var request = new XMLHttpRequest();
1104
-
1105
- // HTTP basic authentication
1106
- if (config.auth) {
1107
- var username = config.auth.username || '';
1108
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
1109
- requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
1110
- }
1111
-
1112
- var fullPath = buildFullPath(config.baseURL, config.url);
1113
-
1114
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
1115
-
1116
- // Set the request timeout in MS
1117
- request.timeout = config.timeout;
1118
-
1119
- function onloadend() {
1120
- if (!request) {
1121
- return;
1122
- }
1123
- // Prepare the response
1124
- var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
1125
- var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
1126
- request.responseText : request.response;
1127
- var response = {
1128
- data: responseData,
1129
- status: request.status,
1130
- statusText: request.statusText,
1131
- headers: responseHeaders,
1132
- config: config,
1133
- request: request
1134
- };
1135
-
1136
- settle(function _resolve(value) {
1137
- resolve(value);
1138
- done();
1139
- }, function _reject(err) {
1140
- reject(err);
1141
- done();
1142
- }, response);
1143
-
1144
- // Clean up request
1145
- request = null;
1146
- }
1147
-
1148
- if ('onloadend' in request) {
1149
- // Use onloadend if available
1150
- request.onloadend = onloadend;
1151
- } else {
1152
- // Listen for ready state to emulate onloadend
1153
- request.onreadystatechange = function handleLoad() {
1154
- if (!request || request.readyState !== 4) {
1155
- return;
1156
- }
1157
-
1158
- // The request errored out and we didn't get a response, this will be
1159
- // handled by onerror instead
1160
- // With one exception: request that using file: protocol, most browsers
1161
- // will return status as 0 even though it's a successful request
1162
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
1163
- return;
1164
- }
1165
- // readystate handler is calling before onerror or ontimeout handlers,
1166
- // so we should call onloadend on the next 'tick'
1167
- setTimeout(onloadend);
1168
- };
1169
- }
1170
-
1171
- // Handle browser request cancellation (as opposed to a manual cancellation)
1172
- request.onabort = function handleAbort() {
1173
- if (!request) {
1174
- return;
1175
- }
1176
-
1177
- reject(new AxiosError_1('Request aborted', AxiosError_1.ECONNABORTED, config, request));
1178
-
1179
- // Clean up request
1180
- request = null;
1181
- };
1182
-
1183
- // Handle low level network errors
1184
- request.onerror = function handleError() {
1185
- // Real errors are hidden from us by the browser
1186
- // onerror should only fire if it's a network error
1187
- reject(new AxiosError_1('Network Error', AxiosError_1.ERR_NETWORK, config, request, request));
1188
-
1189
- // Clean up request
1190
- request = null;
1191
- };
1192
-
1193
- // Handle timeout
1194
- request.ontimeout = function handleTimeout() {
1195
- var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
1196
- var transitional$1 = config.transitional || transitional;
1197
- if (config.timeoutErrorMessage) {
1198
- timeoutErrorMessage = config.timeoutErrorMessage;
1199
- }
1200
- reject(new AxiosError_1(
1201
- timeoutErrorMessage,
1202
- transitional$1.clarifyTimeoutError ? AxiosError_1.ETIMEDOUT : AxiosError_1.ECONNABORTED,
1203
- config,
1204
- request));
1205
-
1206
- // Clean up request
1207
- request = null;
1208
- };
1209
-
1210
- // Add xsrf header
1211
- // This is only done if running in a standard browser environment.
1212
- // Specifically not if we're in a web worker, or react-native.
1213
- if (utils.isStandardBrowserEnv()) {
1214
- // Add xsrf header
1215
- var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
1216
- cookies.read(config.xsrfCookieName) :
1217
- undefined;
1218
-
1219
- if (xsrfValue) {
1220
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
1221
- }
1222
- }
1223
-
1224
- // Add headers to the request
1225
- if ('setRequestHeader' in request) {
1226
- utils.forEach(requestHeaders, function setRequestHeader(val, key) {
1227
- if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
1228
- // Remove Content-Type if data is undefined
1229
- delete requestHeaders[key];
1230
- } else {
1231
- // Otherwise add header to the request
1232
- request.setRequestHeader(key, val);
1233
- }
1234
- });
1235
- }
1236
-
1237
- // Add withCredentials to request if needed
1238
- if (!utils.isUndefined(config.withCredentials)) {
1239
- request.withCredentials = !!config.withCredentials;
1240
- }
1241
-
1242
- // Add responseType to request if needed
1243
- if (responseType && responseType !== 'json') {
1244
- request.responseType = config.responseType;
1245
- }
1246
-
1247
- // Handle progress if needed
1248
- if (typeof config.onDownloadProgress === 'function') {
1249
- request.addEventListener('progress', config.onDownloadProgress);
1250
- }
1251
-
1252
- // Not all browsers support upload events
1253
- if (typeof config.onUploadProgress === 'function' && request.upload) {
1254
- request.upload.addEventListener('progress', config.onUploadProgress);
1255
- }
1256
-
1257
- if (config.cancelToken || config.signal) {
1258
- // Handle cancellation
1259
- // eslint-disable-next-line func-names
1260
- onCanceled = function(cancel) {
1261
- if (!request) {
1262
- return;
1263
- }
1264
- reject(!cancel || (cancel && cancel.type) ? new CanceledError_1() : cancel);
1265
- request.abort();
1266
- request = null;
1267
- };
1268
-
1269
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
1270
- if (config.signal) {
1271
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
1272
- }
1273
- }
1274
-
1275
- if (!requestData) {
1276
- requestData = null;
1277
- }
1278
-
1279
- var protocol = parseProtocol(fullPath);
1280
-
1281
- if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) {
1282
- reject(new AxiosError_1('Unsupported protocol ' + protocol + ':', AxiosError_1.ERR_BAD_REQUEST, config));
1283
- return;
1284
- }
1285
-
1286
-
1287
- // Send the request
1288
- request.send(requestData);
1289
- });
1290
- };
1291
-
1292
- // eslint-disable-next-line strict
1293
- var _null = null;
1294
-
1295
- var DEFAULT_CONTENT_TYPE = {
1296
- 'Content-Type': 'application/x-www-form-urlencoded'
1297
- };
1298
-
1299
- function setContentTypeIfUnset(headers, value) {
1300
- if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
1301
- headers['Content-Type'] = value;
1302
- }
1303
- }
1304
-
1305
- function getDefaultAdapter() {
1306
- var adapter;
1307
- if (typeof XMLHttpRequest !== 'undefined') {
1308
- // For browsers use XHR adapter
1309
- adapter = xhr;
1310
- } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
1311
- // For node use HTTP adapter
1312
- adapter = xhr;
1313
- }
1314
- return adapter;
1315
- }
1316
-
1317
- function stringifySafely(rawValue, parser, encoder) {
1318
- if (utils.isString(rawValue)) {
1319
- try {
1320
- (parser || JSON.parse)(rawValue);
1321
- return utils.trim(rawValue);
1322
- } catch (e) {
1323
- if (e.name !== 'SyntaxError') {
1324
- throw e;
1325
- }
1326
- }
1327
- }
1328
-
1329
- return (encoder || JSON.stringify)(rawValue);
1330
- }
1331
-
1332
- var defaults = {
1333
-
1334
- transitional: transitional,
1335
-
1336
- adapter: getDefaultAdapter(),
1337
-
1338
- transformRequest: [function transformRequest(data, headers) {
1339
- normalizeHeaderName(headers, 'Accept');
1340
- normalizeHeaderName(headers, 'Content-Type');
1341
-
1342
- if (utils.isFormData(data) ||
1343
- utils.isArrayBuffer(data) ||
1344
- utils.isBuffer(data) ||
1345
- utils.isStream(data) ||
1346
- utils.isFile(data) ||
1347
- utils.isBlob(data)
1348
- ) {
1349
- return data;
1350
- }
1351
- if (utils.isArrayBufferView(data)) {
1352
- return data.buffer;
1353
- }
1354
- if (utils.isURLSearchParams(data)) {
1355
- setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
1356
- return data.toString();
1357
- }
1358
-
1359
- var isObjectPayload = utils.isObject(data);
1360
- var contentType = headers && headers['Content-Type'];
1361
-
1362
- var isFileList;
1363
-
1364
- if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) {
1365
- var _FormData = this.env && this.env.FormData;
1366
- return toFormData_1(isFileList ? {'files[]': data} : data, _FormData && new _FormData());
1367
- } else if (isObjectPayload || contentType === 'application/json') {
1368
- setContentTypeIfUnset(headers, 'application/json');
1369
- return stringifySafely(data);
1370
- }
1371
-
1372
- return data;
1373
- }],
1374
-
1375
- transformResponse: [function transformResponse(data) {
1376
- var transitional = this.transitional || defaults.transitional;
1377
- var silentJSONParsing = transitional && transitional.silentJSONParsing;
1378
- var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1379
- var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
1380
-
1381
- if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
1382
- try {
1383
- return JSON.parse(data);
1384
- } catch (e) {
1385
- if (strictJSONParsing) {
1386
- if (e.name === 'SyntaxError') {
1387
- throw AxiosError_1.from(e, AxiosError_1.ERR_BAD_RESPONSE, this, null, this.response);
1388
- }
1389
- throw e;
1390
- }
1391
- }
1392
- }
1393
-
1394
- return data;
1395
- }],
1396
-
1397
- /**
1398
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
1399
- * timeout is not created.
1400
- */
1401
- timeout: 0,
1402
-
1403
- xsrfCookieName: 'XSRF-TOKEN',
1404
- xsrfHeaderName: 'X-XSRF-TOKEN',
1405
-
1406
- maxContentLength: -1,
1407
- maxBodyLength: -1,
1408
-
1409
- env: {
1410
- FormData: _null
1411
- },
1412
-
1413
- validateStatus: function validateStatus(status) {
1414
- return status >= 200 && status < 300;
1415
- },
1416
-
1417
- headers: {
1418
- common: {
1419
- 'Accept': 'application/json, text/plain, */*'
1420
- }
1421
- }
1422
- };
1423
-
1424
- utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
1425
- defaults.headers[method] = {};
1426
- });
1427
-
1428
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
1429
- defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
1430
- });
1431
-
1432
- var defaults_1 = defaults;
1433
-
1434
- /**
1435
- * Transform the data for a request or a response
1436
- *
1437
- * @param {Object|String} data The data to be transformed
1438
- * @param {Array} headers The headers for the request or response
1439
- * @param {Array|Function} fns A single function or Array of functions
1440
- * @returns {*} The resulting transformed data
1441
- */
1442
- var transformData = function transformData(data, headers, fns) {
1443
- var context = this || defaults_1;
1444
- /*eslint no-param-reassign:0*/
1445
- utils.forEach(fns, function transform(fn) {
1446
- data = fn.call(context, data, headers);
1447
- });
1448
-
1449
- return data;
1450
- };
1451
-
1452
- var isCancel = function isCancel(value) {
1453
- return !!(value && value.__CANCEL__);
1454
- };
1455
-
1456
- /**
1457
- * Throws a `CanceledError` if cancellation has been requested.
1458
- */
1459
- function throwIfCancellationRequested(config) {
1460
- if (config.cancelToken) {
1461
- config.cancelToken.throwIfRequested();
1462
- }
1463
-
1464
- if (config.signal && config.signal.aborted) {
1465
- throw new CanceledError_1();
1466
- }
1467
- }
1468
-
1469
- /**
1470
- * Dispatch a request to the server using the configured adapter.
1471
- *
1472
- * @param {object} config The config that is to be used for the request
1473
- * @returns {Promise} The Promise to be fulfilled
1474
- */
1475
- var dispatchRequest = function dispatchRequest(config) {
1476
- throwIfCancellationRequested(config);
1477
-
1478
- // Ensure headers exist
1479
- config.headers = config.headers || {};
1480
-
1481
- // Transform request data
1482
- config.data = transformData.call(
1483
- config,
1484
- config.data,
1485
- config.headers,
1486
- config.transformRequest
1487
- );
1488
-
1489
- // Flatten headers
1490
- config.headers = utils.merge(
1491
- config.headers.common || {},
1492
- config.headers[config.method] || {},
1493
- config.headers
1494
- );
1495
-
1496
- utils.forEach(
1497
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
1498
- function cleanHeaderConfig(method) {
1499
- delete config.headers[method];
1500
- }
1501
- );
1502
-
1503
- var adapter = config.adapter || defaults_1.adapter;
1504
-
1505
- return adapter(config).then(function onAdapterResolution(response) {
1506
- throwIfCancellationRequested(config);
1507
-
1508
- // Transform response data
1509
- response.data = transformData.call(
1510
- config,
1511
- response.data,
1512
- response.headers,
1513
- config.transformResponse
1514
- );
1515
-
1516
- return response;
1517
- }, function onAdapterRejection(reason) {
1518
- if (!isCancel(reason)) {
1519
- throwIfCancellationRequested(config);
1520
-
1521
- // Transform response data
1522
- if (reason && reason.response) {
1523
- reason.response.data = transformData.call(
1524
- config,
1525
- reason.response.data,
1526
- reason.response.headers,
1527
- config.transformResponse
1528
- );
1529
- }
1530
- }
1531
-
1532
- return Promise.reject(reason);
1533
- });
1534
- };
1535
-
1536
- /**
1537
- * Config-specific merge-function which creates a new config-object
1538
- * by merging two configuration objects together.
1539
- *
1540
- * @param {Object} config1
1541
- * @param {Object} config2
1542
- * @returns {Object} New object resulting from merging config2 to config1
1543
- */
1544
- var mergeConfig = function mergeConfig(config1, config2) {
1545
- // eslint-disable-next-line no-param-reassign
1546
- config2 = config2 || {};
1547
- var config = {};
1548
-
1549
- function getMergedValue(target, source) {
1550
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
1551
- return utils.merge(target, source);
1552
- } else if (utils.isPlainObject(source)) {
1553
- return utils.merge({}, source);
1554
- } else if (utils.isArray(source)) {
1555
- return source.slice();
1556
- }
1557
- return source;
1558
- }
1559
-
1560
- // eslint-disable-next-line consistent-return
1561
- function mergeDeepProperties(prop) {
1562
- if (!utils.isUndefined(config2[prop])) {
1563
- return getMergedValue(config1[prop], config2[prop]);
1564
- } else if (!utils.isUndefined(config1[prop])) {
1565
- return getMergedValue(undefined, config1[prop]);
1566
- }
1567
- }
1568
-
1569
- // eslint-disable-next-line consistent-return
1570
- function valueFromConfig2(prop) {
1571
- if (!utils.isUndefined(config2[prop])) {
1572
- return getMergedValue(undefined, config2[prop]);
1573
- }
1574
- }
1575
-
1576
- // eslint-disable-next-line consistent-return
1577
- function defaultToConfig2(prop) {
1578
- if (!utils.isUndefined(config2[prop])) {
1579
- return getMergedValue(undefined, config2[prop]);
1580
- } else if (!utils.isUndefined(config1[prop])) {
1581
- return getMergedValue(undefined, config1[prop]);
1582
- }
1583
- }
1584
-
1585
- // eslint-disable-next-line consistent-return
1586
- function mergeDirectKeys(prop) {
1587
- if (prop in config2) {
1588
- return getMergedValue(config1[prop], config2[prop]);
1589
- } else if (prop in config1) {
1590
- return getMergedValue(undefined, config1[prop]);
1591
- }
1592
- }
1593
-
1594
- var mergeMap = {
1595
- 'url': valueFromConfig2,
1596
- 'method': valueFromConfig2,
1597
- 'data': valueFromConfig2,
1598
- 'baseURL': defaultToConfig2,
1599
- 'transformRequest': defaultToConfig2,
1600
- 'transformResponse': defaultToConfig2,
1601
- 'paramsSerializer': defaultToConfig2,
1602
- 'timeout': defaultToConfig2,
1603
- 'timeoutMessage': defaultToConfig2,
1604
- 'withCredentials': defaultToConfig2,
1605
- 'adapter': defaultToConfig2,
1606
- 'responseType': defaultToConfig2,
1607
- 'xsrfCookieName': defaultToConfig2,
1608
- 'xsrfHeaderName': defaultToConfig2,
1609
- 'onUploadProgress': defaultToConfig2,
1610
- 'onDownloadProgress': defaultToConfig2,
1611
- 'decompress': defaultToConfig2,
1612
- 'maxContentLength': defaultToConfig2,
1613
- 'maxBodyLength': defaultToConfig2,
1614
- 'beforeRedirect': defaultToConfig2,
1615
- 'transport': defaultToConfig2,
1616
- 'httpAgent': defaultToConfig2,
1617
- 'httpsAgent': defaultToConfig2,
1618
- 'cancelToken': defaultToConfig2,
1619
- 'socketPath': defaultToConfig2,
1620
- 'responseEncoding': defaultToConfig2,
1621
- 'validateStatus': mergeDirectKeys
1622
- };
1623
-
1624
- utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
1625
- var merge = mergeMap[prop] || mergeDeepProperties;
1626
- var configValue = merge(prop);
1627
- (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
1628
- });
1629
-
1630
- return config;
1631
- };
1632
-
1633
- var data = {
1634
- "version": "0.27.2"
1635
- };
1636
-
1637
- var VERSION = data.version;
1638
-
1639
-
1640
- var validators$1 = {};
1641
-
1642
- // eslint-disable-next-line func-names
1643
- ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
1644
- validators$1[type] = function validator(thing) {
1645
- return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
1646
- };
1647
- });
1648
-
1649
- var deprecatedWarnings = {};
1650
-
1651
- /**
1652
- * Transitional option validator
1653
- * @param {function|boolean?} validator - set to false if the transitional option has been removed
1654
- * @param {string?} version - deprecated version / removed since version
1655
- * @param {string?} message - some message with additional info
1656
- * @returns {function}
1657
- */
1658
- validators$1.transitional = function transitional(validator, version, message) {
1659
- function formatMessage(opt, desc) {
1660
- return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
1661
- }
1662
-
1663
- // eslint-disable-next-line func-names
1664
- return function(value, opt, opts) {
1665
- if (validator === false) {
1666
- throw new AxiosError_1(
1667
- formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
1668
- AxiosError_1.ERR_DEPRECATED
1669
- );
1670
- }
1671
-
1672
- if (version && !deprecatedWarnings[opt]) {
1673
- deprecatedWarnings[opt] = true;
1674
- // eslint-disable-next-line no-console
1675
- console.warn(
1676
- formatMessage(
1677
- opt,
1678
- ' has been deprecated since v' + version + ' and will be removed in the near future'
1679
- )
1680
- );
1681
- }
1682
-
1683
- return validator ? validator(value, opt, opts) : true;
1684
- };
1685
- };
1686
-
1687
- /**
1688
- * Assert object's properties type
1689
- * @param {object} options
1690
- * @param {object} schema
1691
- * @param {boolean?} allowUnknown
1692
- */
1693
-
1694
- function assertOptions(options, schema, allowUnknown) {
1695
- if (typeof options !== 'object') {
1696
- throw new AxiosError_1('options must be an object', AxiosError_1.ERR_BAD_OPTION_VALUE);
1697
- }
1698
- var keys = Object.keys(options);
1699
- var i = keys.length;
1700
- while (i-- > 0) {
1701
- var opt = keys[i];
1702
- var validator = schema[opt];
1703
- if (validator) {
1704
- var value = options[opt];
1705
- var result = value === undefined || validator(value, opt, options);
1706
- if (result !== true) {
1707
- throw new AxiosError_1('option ' + opt + ' must be ' + result, AxiosError_1.ERR_BAD_OPTION_VALUE);
1708
- }
1709
- continue;
1710
- }
1711
- if (allowUnknown !== true) {
1712
- throw new AxiosError_1('Unknown option ' + opt, AxiosError_1.ERR_BAD_OPTION);
1713
- }
1714
- }
1715
- }
1716
-
1717
- var validator = {
1718
- assertOptions: assertOptions,
1719
- validators: validators$1
1720
- };
1721
-
1722
- var validators = validator.validators;
1723
- /**
1724
- * Create a new instance of Axios
1725
- *
1726
- * @param {Object} instanceConfig The default config for the instance
1727
- */
1728
- function Axios(instanceConfig) {
1729
- this.defaults = instanceConfig;
1730
- this.interceptors = {
1731
- request: new InterceptorManager_1(),
1732
- response: new InterceptorManager_1()
1733
- };
1734
- }
1735
-
1736
- /**
1737
- * Dispatch a request
1738
- *
1739
- * @param {Object} config The config specific for this request (merged with this.defaults)
1740
- */
1741
- Axios.prototype.request = function request(configOrUrl, config) {
1742
- /*eslint no-param-reassign:0*/
1743
- // Allow for axios('example/url'[, config]) a la fetch API
1744
- if (typeof configOrUrl === 'string') {
1745
- config = config || {};
1746
- config.url = configOrUrl;
1747
- } else {
1748
- config = configOrUrl || {};
1749
- }
1750
-
1751
- config = mergeConfig(this.defaults, config);
1752
-
1753
- // Set config.method
1754
- if (config.method) {
1755
- config.method = config.method.toLowerCase();
1756
- } else if (this.defaults.method) {
1757
- config.method = this.defaults.method.toLowerCase();
1758
- } else {
1759
- config.method = 'get';
1760
- }
1761
-
1762
- var transitional = config.transitional;
1763
-
1764
- if (transitional !== undefined) {
1765
- validator.assertOptions(transitional, {
1766
- silentJSONParsing: validators.transitional(validators.boolean),
1767
- forcedJSONParsing: validators.transitional(validators.boolean),
1768
- clarifyTimeoutError: validators.transitional(validators.boolean)
1769
- }, false);
1770
- }
1771
-
1772
- // filter out skipped interceptors
1773
- var requestInterceptorChain = [];
1774
- var synchronousRequestInterceptors = true;
1775
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
1776
- if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
1777
- return;
1778
- }
1779
-
1780
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
1781
-
1782
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
1783
- });
1784
-
1785
- var responseInterceptorChain = [];
1786
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
1787
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
1788
- });
1789
-
1790
- var promise;
1791
-
1792
- if (!synchronousRequestInterceptors) {
1793
- var chain = [dispatchRequest, undefined];
1794
-
1795
- Array.prototype.unshift.apply(chain, requestInterceptorChain);
1796
- chain = chain.concat(responseInterceptorChain);
1797
-
1798
- promise = Promise.resolve(config);
1799
- while (chain.length) {
1800
- promise = promise.then(chain.shift(), chain.shift());
1801
- }
1802
-
1803
- return promise;
1804
- }
1805
-
1806
-
1807
- var newConfig = config;
1808
- while (requestInterceptorChain.length) {
1809
- var onFulfilled = requestInterceptorChain.shift();
1810
- var onRejected = requestInterceptorChain.shift();
1811
- try {
1812
- newConfig = onFulfilled(newConfig);
1813
- } catch (error) {
1814
- onRejected(error);
1815
- break;
1816
- }
1817
- }
1818
-
1819
- try {
1820
- promise = dispatchRequest(newConfig);
1821
- } catch (error) {
1822
- return Promise.reject(error);
1823
- }
1824
-
1825
- while (responseInterceptorChain.length) {
1826
- promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
1827
- }
1828
-
1829
- return promise;
1830
- };
1831
-
1832
- Axios.prototype.getUri = function getUri(config) {
1833
- config = mergeConfig(this.defaults, config);
1834
- var fullPath = buildFullPath(config.baseURL, config.url);
1835
- return buildURL(fullPath, config.params, config.paramsSerializer);
1836
- };
1837
-
1838
- // Provide aliases for supported request methods
1839
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
1840
- /*eslint func-names:0*/
1841
- Axios.prototype[method] = function(url, config) {
1842
- return this.request(mergeConfig(config || {}, {
1843
- method: method,
1844
- url: url,
1845
- data: (config || {}).data
1846
- }));
1847
- };
1848
- });
1849
-
1850
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
1851
- /*eslint func-names:0*/
1852
-
1853
- function generateHTTPMethod(isForm) {
1854
- return function httpMethod(url, data, config) {
1855
- return this.request(mergeConfig(config || {}, {
1856
- method: method,
1857
- headers: isForm ? {
1858
- 'Content-Type': 'multipart/form-data'
1859
- } : {},
1860
- url: url,
1861
- data: data
1862
- }));
1863
- };
1864
- }
1865
-
1866
- Axios.prototype[method] = generateHTTPMethod();
1867
-
1868
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
1869
- });
1870
-
1871
- var Axios_1 = Axios;
1872
-
1873
- /**
1874
- * A `CancelToken` is an object that can be used to request cancellation of an operation.
1875
- *
1876
- * @class
1877
- * @param {Function} executor The executor function.
1878
- */
1879
- function CancelToken(executor) {
1880
- if (typeof executor !== 'function') {
1881
- throw new TypeError('executor must be a function.');
1882
- }
1883
-
1884
- var resolvePromise;
1885
-
1886
- this.promise = new Promise(function promiseExecutor(resolve) {
1887
- resolvePromise = resolve;
1888
- });
1889
-
1890
- var token = this;
1891
-
1892
- // eslint-disable-next-line func-names
1893
- this.promise.then(function(cancel) {
1894
- if (!token._listeners) return;
1895
-
1896
- var i;
1897
- var l = token._listeners.length;
1898
-
1899
- for (i = 0; i < l; i++) {
1900
- token._listeners[i](cancel);
1901
- }
1902
- token._listeners = null;
1903
- });
1904
-
1905
- // eslint-disable-next-line func-names
1906
- this.promise.then = function(onfulfilled) {
1907
- var _resolve;
1908
- // eslint-disable-next-line func-names
1909
- var promise = new Promise(function(resolve) {
1910
- token.subscribe(resolve);
1911
- _resolve = resolve;
1912
- }).then(onfulfilled);
1913
-
1914
- promise.cancel = function reject() {
1915
- token.unsubscribe(_resolve);
1916
- };
1917
-
1918
- return promise;
1919
- };
1920
-
1921
- executor(function cancel(message) {
1922
- if (token.reason) {
1923
- // Cancellation has already been requested
1924
- return;
1925
- }
1926
-
1927
- token.reason = new CanceledError_1(message);
1928
- resolvePromise(token.reason);
1929
- });
1930
- }
1931
-
1932
- /**
1933
- * Throws a `CanceledError` if cancellation has been requested.
1934
- */
1935
- CancelToken.prototype.throwIfRequested = function throwIfRequested() {
1936
- if (this.reason) {
1937
- throw this.reason;
1938
- }
1939
- };
1940
-
1941
- /**
1942
- * Subscribe to the cancel signal
1943
- */
1944
-
1945
- CancelToken.prototype.subscribe = function subscribe(listener) {
1946
- if (this.reason) {
1947
- listener(this.reason);
1948
- return;
1949
- }
1950
-
1951
- if (this._listeners) {
1952
- this._listeners.push(listener);
1953
- } else {
1954
- this._listeners = [listener];
1955
- }
1956
- };
1957
-
1958
- /**
1959
- * Unsubscribe from the cancel signal
1960
- */
1961
-
1962
- CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
1963
- if (!this._listeners) {
1964
- return;
1965
- }
1966
- var index = this._listeners.indexOf(listener);
1967
- if (index !== -1) {
1968
- this._listeners.splice(index, 1);
1969
- }
1970
- };
1971
-
1972
- /**
1973
- * Returns an object that contains a new `CancelToken` and a function that, when called,
1974
- * cancels the `CancelToken`.
1975
- */
1976
- CancelToken.source = function source() {
1977
- var cancel;
1978
- var token = new CancelToken(function executor(c) {
1979
- cancel = c;
1980
- });
1981
- return {
1982
- token: token,
1983
- cancel: cancel
1984
- };
1985
- };
1986
-
1987
- var CancelToken_1 = CancelToken;
1988
-
1989
- /**
1990
- * Syntactic sugar for invoking a function and expanding an array for arguments.
1991
- *
1992
- * Common use case would be to use `Function.prototype.apply`.
1993
- *
1994
- * ```js
1995
- * function f(x, y, z) {}
1996
- * var args = [1, 2, 3];
1997
- * f.apply(null, args);
1998
- * ```
1999
- *
2000
- * With `spread` this example can be re-written.
2001
- *
2002
- * ```js
2003
- * spread(function(x, y, z) {})([1, 2, 3]);
2004
- * ```
2005
- *
2006
- * @param {Function} callback
2007
- * @returns {Function}
2008
- */
2009
- var spread = function spread(callback) {
2010
- return function wrap(arr) {
2011
- return callback.apply(null, arr);
2012
- };
2013
- };
2014
-
2015
- /**
2016
- * Determines whether the payload is an error thrown by Axios
2017
- *
2018
- * @param {*} payload The value to test
2019
- * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
2020
- */
2021
- var isAxiosError = function isAxiosError(payload) {
2022
- return utils.isObject(payload) && (payload.isAxiosError === true);
2023
- };
2024
-
2025
- /**
2026
- * Create an instance of Axios
2027
- *
2028
- * @param {Object} defaultConfig The default config for the instance
2029
- * @return {Axios} A new instance of Axios
2030
- */
2031
- function createInstance(defaultConfig) {
2032
- var context = new Axios_1(defaultConfig);
2033
- var instance = bind(Axios_1.prototype.request, context);
2034
-
2035
- // Copy axios.prototype to instance
2036
- utils.extend(instance, Axios_1.prototype, context);
2037
-
2038
- // Copy context to instance
2039
- utils.extend(instance, context);
2040
-
2041
- // Factory for creating new instances
2042
- instance.create = function create(instanceConfig) {
2043
- return createInstance(mergeConfig(defaultConfig, instanceConfig));
2044
- };
2045
-
2046
- return instance;
2047
- }
2048
-
2049
- // Create the default instance to be exported
2050
- var axios$1 = createInstance(defaults_1);
2051
-
2052
- // Expose Axios class to allow class inheritance
2053
- axios$1.Axios = Axios_1;
2054
-
2055
- // Expose Cancel & CancelToken
2056
- axios$1.CanceledError = CanceledError_1;
2057
- axios$1.CancelToken = CancelToken_1;
2058
- axios$1.isCancel = isCancel;
2059
- axios$1.VERSION = data.version;
2060
- axios$1.toFormData = toFormData_1;
2061
-
2062
- // Expose AxiosError class
2063
- axios$1.AxiosError = AxiosError_1;
2064
-
2065
- // alias for CanceledError for backward compatibility
2066
- axios$1.Cancel = axios$1.CanceledError;
2067
-
2068
- // Expose all/spread
2069
- axios$1.all = function all(promises) {
2070
- return Promise.all(promises);
2071
- };
2072
- axios$1.spread = spread;
2073
-
2074
- // Expose isAxiosError
2075
- axios$1.isAxiosError = isAxiosError;
2076
-
2077
- var axios_1 = axios$1;
2078
-
2079
- // Allow use of default import syntax in TypeScript
2080
- var _default = axios$1;
2081
- axios_1.default = _default;
2082
-
2083
- var axios = axios_1;
2084
-
2085
- // This file provides a polyfill for managing globals in both NodeJS and browser environments. This is
2086
- // an anti-pattern we'd hoped to avoid, but we have several projects dependending on one common library
2087
- // (this js-sdk) and we want that library to provide a common endpoint to all callers (so authentication
2088
- // tokens only need to be tracked in one place). The trouble is, one of those libraries is based on
2089
- // StencilJS and is compiling its modules into Web Components. Because of how module resolution works,
2090
- // when those Components load js-sdk they get a separate instance. Without messy options like having to
2091
- // pass raw data from the caller to each Component, or pass around references to a common Endpoint, they
2092
- // have no way to access authenticated sessions unless we make the Endpoint a true global.
2093
- //
2094
- // @credit https://github.com/medikoo/es5-ext/blob/master/global.js
2095
- // @credit https://mathiasbynens.be/notes/globalthis
2096
- var naiveFallback = function () {
2097
- if (typeof self === 'object' && self)
2098
- return self;
2099
- if (typeof window === 'object' && window)
2100
- return window;
2101
- throw new Error('Unable to resolve global `this`');
2102
- };
2103
- var globalThis_1 = (function () {
2104
- if (this)
2105
- return this;
2106
- // Unexpected strict mode (may happen if e.g. bundled into ESM module)
2107
- // Fallback to standard globalThis if available
2108
- if (typeof globalThis === 'object' && globalThis)
2109
- return globalThis;
2110
- // Thanks @mathiasbynens -> https://mathiasbynens.be/notes/globalthis
2111
- // In all ES5+ engines global object inherits from Object.prototype
2112
- // (if you approached one that doesn't please report)
2113
- try {
2114
- Object.defineProperty(Object.prototype, '__global__', {
2115
- get: function () {
2116
- return this;
2117
- },
2118
- configurable: true,
2119
- });
2120
- }
2121
- catch (error) {
2122
- // Unfortunate case of updates to Object.prototype being restricted
2123
- // via preventExtensions, seal or freeze
2124
- return naiveFallback();
2125
- }
2126
- try {
2127
- // Safari case (window.__global__ works, but __global__ does not)
2128
- if (!__global__)
2129
- return naiveFallback();
2130
- return __global__;
2131
- }
2132
- finally {
2133
- delete Object.prototype.__global__;
2134
- }
2135
- })();
2136
-
2137
- // @credit https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/
2138
- // Also see globalThis for comments about why we're doing this in the first place.
2139
- var ENDPOINT_KEY = Symbol.for('verdocs-default-endpoint');
2140
- var requestLogger = function (r) {
2141
- // tslint:disable-next-line
2142
- console.debug("[JS-SDK] ".concat(r.method.toUpperCase(), " ").concat(r.baseURL).concat(r.url), r.data ? JSON.stringify(r.data) : '');
2143
- return r;
2144
- };
2145
- /**
2146
- * VerdocsEndpoint is a class wrapper for a specific connection and authorization context for calling the Verdocs APIs.
2147
- * Endpoints can be used for isolated session tasks.
2148
- *
2149
- * For instance, ephemeral signing sessions may be created independently of a caller's status as an authenticated user.
2150
- * In that case, an Endpoint can be created and authenticated, used for calls related to signing operations, then
2151
- * discarded once signing is complete.
2152
- *
2153
- * Note that endpoint configuration functions return the instance, so they can be chained, e.g.
2154
- *
2155
- * ```typescript
2156
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
2157
- *
2158
- * const endpoint = new VerdocsEndpoint();
2159
- * endpoint
2160
- * .setSessionType('signing')
2161
- * .logRequests(true)
2162
- * .setClientID('1234)
2163
- * .setTimeout(5000);
2164
- * ```
2165
- */
2166
- var VerdocsEndpoint = /** @class */ (function () {
2167
- /**
2168
- * Create a new VerdocsEndpoint to call Verdocs platform services.
2169
- *
2170
- * ```typescript
2171
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
2172
- * const endpoint = new VerdocsEndpoint();
2173
- * ```
2174
- */
2175
- function VerdocsEndpoint(options) {
2176
- this.environment = 'verdocs';
2177
- this.sessionType = 'user';
2178
- this.baseURL = 'https://api.verdocs.com';
2179
- this.clientID = 'not-set';
2180
- this.timeout = 3000;
2181
- this.token = null;
2182
- this.nextListenerId = 0;
2183
- this.sessionListeners = new Map();
2184
- this.requestLoggerId = null;
2185
- /**
2186
- * The current user session, or null if not authenticated. May be either a User or Signing session. If set, the
2187
- * presence of the `document_id` field can be used to differentiate the types. Only signing sessions are associated
2188
- * with Documents.
2189
- */
2190
- this.session = null;
2191
- this.baseURL = (options === null || options === void 0 ? void 0 : options.baseURL) || 'https://api.verdocs.com';
2192
- this.timeout = (options === null || options === void 0 ? void 0 : options.timeout) || 3000;
2193
- this.environment = (options === null || options === void 0 ? void 0 : options.environment) || 'verdocs';
2194
- this.sessionType = (options === null || options === void 0 ? void 0 : options.sessionType) || 'user';
2195
- this.clientID = (options === null || options === void 0 ? void 0 : options.clientID) || 'not-set';
2196
- this.api = axios.create({ baseURL: this.baseURL, timeout: this.timeout });
2197
- }
2198
- VerdocsEndpoint.prototype.setDefault = function () {
2199
- globalThis_1[ENDPOINT_KEY] = this;
2200
- };
2201
- VerdocsEndpoint.getDefault = function () {
2202
- if (!globalThis_1[ENDPOINT_KEY]) {
2203
- globalThis_1[ENDPOINT_KEY] = new VerdocsEndpoint();
2204
- window.console.debug('[JS_SDK] Created default endpoint', globalThis_1[ENDPOINT_KEY]);
2205
- }
2206
- return globalThis_1[ENDPOINT_KEY];
2207
- };
2208
- /**
2209
- * Get the current environment.
2210
- */
2211
- VerdocsEndpoint.prototype.getEnvironment = function () {
2212
- return this.environment;
2213
- };
2214
- /**
2215
- * Get the current session type.
2216
- */
2217
- VerdocsEndpoint.prototype.getSessionType = function () {
2218
- return this.sessionType;
2219
- };
2220
- /**
2221
- * Get the current base URL. This should rarely be anything other than 'https://api.verdocs.com'.
2222
- */
2223
- VerdocsEndpoint.prototype.getBaseURL = function () {
2224
- return this.baseURL;
2225
- };
2226
- /**
2227
- * Get the current client ID, if set.
2228
- */
2229
- VerdocsEndpoint.prototype.getClientID = function () {
2230
- return this.clientID;
2231
- };
2232
- /**
2233
- * Get the current timeout.
2234
- */
2235
- VerdocsEndpoint.prototype.getTimeout = function () {
2236
- return this.timeout;
2237
- };
2238
- /**
2239
- * Get the current session, if any.
2240
- */
2241
- VerdocsEndpoint.prototype.getSession = function () {
2242
- return this.session;
2243
- };
2244
- /**
2245
- * Set the operating environment. This should rarely be anything other than 'verdocs'.
2246
- *
2247
- * ```typescript
2248
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
2249
- *
2250
- * const endpoint = new VerdocsEndpoint();
2251
- * endpoint.setEnvironment('verdocs-stage');
2252
- * ```
2253
- */
2254
- VerdocsEndpoint.prototype.setEnvironment = function (environment) {
2255
- this.environment = environment;
2256
- return this;
2257
- };
2258
- /**
2259
- * Set the session type. In general this should be done immediately when the endpoint is created. Changing the
2260
- * session type may be done at any time, but may have unintended consequences if the endpoint is shared between
2261
- * multiple widgets.
2262
- *
2263
- * Changing the session type will clear/reload the action session. This may trigger notifications to session state
2264
- * observers. Apps that use observers to trigger UI updates such as logging the user out should be prepared to
2265
- * handle this event.
2266
- *
2267
- * ```typescript
2268
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
2269
- *
2270
- * const endpoint = new VerdocsEndpoint();
2271
- * endpoint.setEnvironment('verdocs-stage');
2272
- * ```
2273
- */
2274
- VerdocsEndpoint.prototype.setSessionType = function (sessionType) {
2275
- this.sessionType = sessionType;
2276
- return this;
2277
- };
2278
- /**
2279
- * Set the base URL for API calls. Should be called only upon direction from Verdocs Customer Solutions Engineering.
2280
- *
2281
- * ```typescript
2282
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
2283
- *
2284
- * const endpoint = new VerdocsEndpoint();
2285
- * endpoint.setBaseURL('https://api.verdocs.com');
2286
- * ```
2287
- */
2288
- VerdocsEndpoint.prototype.setBaseURL = function (url) {
2289
- this.api.defaults.baseURL = url;
2290
- return this;
2291
- };
2292
- /**
2293
- * Set the Client ID for Verdocs API calls.
2294
- *
2295
- * ```typescript
2296
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
2297
- *
2298
- * const endpoint = new VerdocsEndpoint();
2299
- * endpoint.setClientID('1234);
2300
- * ```
2301
- */
2302
- VerdocsEndpoint.prototype.setClientID = function (clientID) {
2303
- this.clientID = clientID;
2304
- this.api.defaults.headers.common['X-Client-ID'] = clientID;
2305
- return this;
2306
- };
2307
- /**
2308
- * Set the timeout for API calls in milliseconds. 2000-4000ms is recommended for most purposes. 3000ms is the default.
2309
- *
2310
- * ```typescript
2311
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
2312
- *
2313
- * const endpoint = new VerdocsEndpoint();
2314
- * endpoint.setTimeout(3000);
2315
- * ```
2316
- */
2317
- VerdocsEndpoint.prototype.setTimeout = function (timeout) {
2318
- this.timeout = timeout;
2319
- this.api.defaults.timeout = timeout;
2320
- return this;
2321
- };
2322
- /**
2323
- * Enable or disable request logging. This may expose sensitive data in the console log, so it should only be used for debugging.
2324
- *
2325
- * ```typescript
2326
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
2327
- *
2328
- * const endpoint = new VerdocsEndpoint();
2329
- * endpoint.logRequests(true);
2330
- * ```
2331
- */
2332
- VerdocsEndpoint.prototype.logRequests = function (enable) {
2333
- if (enable && this.requestLoggerId === null) {
2334
- this.requestLoggerId = this.api.interceptors.request.use(requestLogger);
2335
- }
2336
- else if (!enable && this.requestLoggerId !== null) {
2337
- this.api.interceptors.request.eject(this.requestLoggerId);
2338
- }
2339
- return this;
2340
- };
2341
- /**
2342
- * Set the authorization token that will be used for Verdocs API calls. This will also set the session metadata
2343
- * and notify any listeners of the new data.
2344
- *
2345
- * If this Endpoint will be used for non-default purposes (e.g. signing, or in an alternate environment) those
2346
- * settings should be made before calling this. Sessions are persisted to localStorage, and the environment and
2347
- * type become part of the storage key.
2348
- *
2349
- * ```typescript
2350
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
2351
- *
2352
- * const endpoint = new VerdocsEndpoint();
2353
- * endpoint.setToken(accessToken);
2354
- * ```
2355
- */
2356
- VerdocsEndpoint.prototype.setToken = function (token) {
2357
- if (!token) {
2358
- return this.clearSession();
2359
- }
2360
- var session = decodeAccessTokenBody(token);
2361
- if (session === null || (session.exp && session.exp * 1000 < new Date().getTime())) {
2362
- return this.clearSession();
2363
- }
2364
- this.token = token;
2365
- this.session = session;
2366
- this.api.defaults.headers.common.Authorization = "Bearer ".concat(token);
2367
- localStorage.setItem(this.sessionStorageKey(), token);
2368
- this.notifySessionListeners();
2369
- return this;
2370
- };
2371
- /**
2372
- * Retrieves the current session token, if any. Tokens should rarely be used for direct actions, but this is
2373
- * required by the `<VerdocsView>` and other components to authorize requests to raw PDF files.
2374
- */
2375
- VerdocsEndpoint.prototype.getToken = function () {
2376
- return this.token;
2377
- };
2378
- VerdocsEndpoint.prototype.sessionStorageKey = function () {
2379
- return "verdocs-session-".concat(this.getSessionType(), "-").concat(this.getEnvironment());
2380
- };
2381
- /**
2382
- * Clear the active session.
2383
- */
2384
- VerdocsEndpoint.prototype.clearSession = function () {
2385
- localStorage.removeItem(this.sessionStorageKey());
2386
- delete this.api.defaults.headers.common.Authorization;
2387
- this.session = null;
2388
- this.token = null;
2389
- this.notifySessionListeners();
2390
- return this;
2391
- };
2392
- VerdocsEndpoint.prototype.notifySessionListeners = function () {
2393
- var _this = this;
2394
- this.sessionListeners.forEach(function (listener) {
2395
- try {
2396
- listener(_this, _this.session);
2397
- }
2398
- catch (e) {
2399
- // NOOP
2400
- }
2401
- });
2402
- };
2403
- /**
2404
- * Subscribe to session state change events.
2405
- */
2406
- VerdocsEndpoint.prototype.onSessionChanged = function (listener) {
2407
- var _this = this;
2408
- // There's no value in randomizing this, a simple counter is fine
2409
- this.nextListenerId++;
2410
- var listenerSymbol = Symbol.for('' + this.nextListenerId);
2411
- this.sessionListeners.set(listenerSymbol, listener);
2412
- return function () {
2413
- _this.sessionListeners.delete(listenerSymbol);
2414
- };
2415
- };
2416
- /**
2417
- * Load a persisted session from localStorage. Typically called once after the endpoint is configured when the app
2418
- * or component starts.
2419
- */
2420
- VerdocsEndpoint.prototype.loadSession = function () {
2421
- var token = localStorage.getItem(this.sessionStorageKey());
2422
- if (!token) {
2423
- return this.clearSession();
2424
- }
2425
- return this.setToken(token);
2426
- };
2427
- return VerdocsEndpoint;
2428
- }());
2429
-
2430
- export { VerdocsEndpoint as V, decodeAccessTokenBody as d };
2431
-
2432
- //# sourceMappingURL=VerdocsEndpoint-82f4600d.js.map