js-cloudimage-360-view 3.0.3 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/.env +3 -0
  2. package/CHANGELOG.md +167 -156
  3. package/LICENSE +27 -33
  4. package/README.md +820 -806
  5. package/bin/deploy-bundle.js +63 -0
  6. package/dist/ci360.service.js +65 -245
  7. package/dist/ci360.utils.js +2 -14
  8. package/dist/constants/index.js +0 -4
  9. package/dist/constants/props-require-reload.js +24 -12
  10. package/dist/index.js +0 -27
  11. package/dist/static/css/hotspots.css +221 -221
  12. package/dist/static/css/style.css +229 -229
  13. package/dist/utils/auto-play/get-speed-factor.js +0 -2
  14. package/dist/utils/auto-play/is-completed-one-cycle.js +0 -5
  15. package/dist/utils/auto-play/loop.js +3 -14
  16. package/dist/utils/class-names/add-class.js +0 -3
  17. package/dist/utils/class-names/remove-class.js +0 -2
  18. package/dist/utils/container-elements/apply-styles-to-container.js +0 -2
  19. package/dist/utils/container-elements/create-360-view-circle-icon.js +0 -2
  20. package/dist/utils/container-elements/create-360-view-icon.js +0 -2
  21. package/dist/utils/container-elements/create-box-shadow.js +0 -2
  22. package/dist/utils/container-elements/create-canvas.js +0 -2
  23. package/dist/utils/container-elements/create-close-fullscreen-icon.js +0 -2
  24. package/dist/utils/container-elements/create-fullscreen-icon.js +0 -2
  25. package/dist/utils/container-elements/create-fullscreen-modal.js +0 -2
  26. package/dist/utils/container-elements/create-icons-container.js +0 -2
  27. package/dist/utils/container-elements/create-inner-box.js +0 -2
  28. package/dist/utils/container-elements/create-loader.js +0 -2
  29. package/dist/utils/container-elements/create-magnifier-icon.js +0 -2
  30. package/dist/utils/container-elements/index.js +0 -13
  31. package/dist/utils/container-elements/remove-child-from-parent.js +0 -2
  32. package/dist/utils/controls/get-item-skipped.js +0 -2
  33. package/dist/utils/controls/init-controls.js +7 -16
  34. package/dist/utils/hotspots/attach-events/hide-popup.js +0 -2
  35. package/dist/utils/hotspots/attach-events/show-popup.js +0 -2
  36. package/dist/utils/hotspots/configs-error-handler.js +6 -10
  37. package/dist/utils/hotspots/create-popper-instace.js +1 -4
  38. package/dist/utils/hotspots/elements/create-carousel-dot.js +0 -6
  39. package/dist/utils/hotspots/elements/create-carousel-image.js +0 -4
  40. package/dist/utils/hotspots/elements/create-hotspot-icon.js +3 -14
  41. package/dist/utils/hotspots/elements/create-hotspot-popup-link.js +2 -6
  42. package/dist/utils/hotspots/elements/create-hotspots.js +0 -5
  43. package/dist/utils/hotspots/elements/create-images-carousel.js +0 -4
  44. package/dist/utils/hotspots/elements/create-modal-description.js +0 -2
  45. package/dist/utils/hotspots/elements/create-modal-title.js +0 -2
  46. package/dist/utils/hotspots/elements/create-model-elements.js +8 -25
  47. package/dist/utils/hotspots/elements/create-popup-arrow.js +0 -2
  48. package/dist/utils/hotspots/elements/create-popup.js +6 -18
  49. package/dist/utils/hotspots/elements/create-read-more-btn.js +0 -2
  50. package/dist/utils/hotspots/fill-empty-coord-with-previous.js +1 -6
  51. package/dist/utils/hotspots/generate-hotspots-configs.js +11 -21
  52. package/dist/utils/hotspots/generate-popup-config.js +9 -11
  53. package/dist/utils/hotspots/get-hotspot-icon.js +0 -2
  54. package/dist/utils/hotspots/get-hotspot-orientation.js +0 -4
  55. package/dist/utils/hotspots/get-hotspot-popup-node.js +0 -2
  56. package/dist/utils/hotspots/get-popup-node.js +0 -2
  57. package/dist/utils/hotspots/hide-hotspot-icon.js +0 -2
  58. package/dist/utils/hotspots/hide-hotspots-icons.js +0 -3
  59. package/dist/utils/hotspots/is-mouse-on-hotspot.js +0 -2
  60. package/dist/utils/hotspots/prepare-hotspots-positions.js +0 -6
  61. package/dist/utils/hotspots/set-current-slide.js +0 -2
  62. package/dist/utils/hotspots/toggle-popup-events.js +0 -4
  63. package/dist/utils/hotspots/update-hotspot-icon-position.js +0 -2
  64. package/dist/utils/hotspots/update-hotspots.js +6 -14
  65. package/dist/utils/image-src/generate-images-path.js +8 -17
  66. package/dist/utils/image-src/is-props-change-require-reload.js +0 -5
  67. package/dist/utils/index.js +0 -26
  68. package/dist/utils/load-images/images-from-folder/prepare-images-from-folder.js +2 -11
  69. package/dist/utils/load-images/images-from-list/prepare-images-from-list.js +0 -8
  70. package/dist/utils/load-images/lazyload/init-lazyload.js +3 -11
  71. package/dist/utils/load-images/lazyload/prepare-first-image/prepare-first-image-from-folder.js +1 -5
  72. package/dist/utils/load-images/lazyload/prepare-first-image/prepare-first-image-from-list.js +0 -9
  73. package/dist/utils/load-images/load-image-as-promise.js +8 -46
  74. package/dist/utils/load-images/load-images-relative-to-container-size.js +10 -49
  75. package/dist/utils/load-images/load-original-images.js +23 -37
  76. package/dist/utils/load-images/pad.js +0 -2
  77. package/dist/utils/load-images/preload-images.js +2 -9
  78. package/dist/utils/load-images/preload-original-images.js +2 -9
  79. package/dist/utils/magnify/get-current-original-image.js +0 -6
  80. package/dist/utils/magnify/get-cursor-position.js +0 -2
  81. package/dist/utils/magnify/magnify.js +4 -11
  82. package/dist/utils/magnify/move-magnifier.js +6 -14
  83. package/dist/utils/responsive/contain.js +0 -2
  84. package/dist/utils/responsive/fit.js +0 -4
  85. package/dist/utils/responsive/get-image-aspect-ratio.js +0 -8
  86. package/dist/utils/responsive/get-responsive-width-of-container.js +0 -3
  87. package/dist/utils/responsive/get-size-according-to-pixel-ratio.js +0 -2
  88. package/dist/utils/responsive/get-size-limit.js +0 -2
  89. package/dist/utils/spin-y/get-moving-direction.js +0 -3
  90. package/dist/utils/zoom/generate-zoom-in-steps.js +0 -2
  91. package/dist/utils/zoom/generate-zoom-out-steps.js +0 -2
  92. package/package.json +67 -62
  93. package/yarn-error.log +101 -0
@@ -0,0 +1,63 @@
1
+ /* eslint-disable no-console */
2
+ require('isomorphic-fetch')
3
+ require('dotenv').config()
4
+ const FormData = require('form-data')
5
+ const { createReadStream } = require('fs')
6
+ const { join } = require('path')
7
+ let { version } = require('../package.json')
8
+
9
+ const splittedVersion = version.split('.')
10
+ version = splittedVersion.filter((v) => parseInt(v) || parseInt(v) === 0).map((v) => parseInt(v)).slice(0, 3).join('.')
11
+
12
+ const apiUrl = process.env.BUNDLE_API_URL || 'https://api.filerobot.com'
13
+
14
+ const pluginsContainer = process.env.BUNDLE_PLUGINS_CONTAINER
15
+ const securityTemplateId = process.env.BUNDLE_UPLOAD_SECURITY_TEMPLATE_ID
16
+ const pluginFolder = `${process.env.BUNDLE_FOLDER}`
17
+ const pluginVersion = version || 'latest'
18
+ const latestFolder = 'latest'
19
+
20
+ const generateSassKey = () => fetch(`${apiUrl}/${pluginsContainer}/key/${securityTemplateId}`)
21
+ .then((res) => res.json()).then((res) => {
22
+ if (res.status === 'error') {
23
+ console.error(`Error while generating SASS key: ${res.msg || res.hint}`)
24
+ } else {
25
+ return res.key
26
+ }
27
+ })
28
+ .catch(() => new Error(`Unable to get SASS key for the provided security template key ${securityTemplateId}`))
29
+
30
+ const statiUploadEndpoint = `${apiUrl}/${pluginsContainer}/v4/files?folder=${pluginFolder}`
31
+
32
+ const deploy = (sassKey, folderName = pluginVersion) => {
33
+ const uploadEndpoint = `${statiUploadEndpoint}/${folderName}`
34
+ const formData = new FormData()
35
+ formData.append('files[]', createReadStream(
36
+ join(__dirname, '../build/js-cloudimage-360-view.min.js')
37
+ ))
38
+
39
+ return fetch(uploadEndpoint, {
40
+ method: 'POST',
41
+ body: formData,
42
+ headers: {
43
+ 'X-Filerobot-Key': sassKey
44
+ }
45
+ })
46
+ .then((res) => res.json())
47
+ .then((res) => {
48
+ if (res.status === 'error') {
49
+ console.error(`Error while deploying:${res.msg ? ` ${res.msg} ` : ''}${res.hint ? `- ${res.hint}` : ''}`)
50
+ } else {
51
+ console.log(`Plugin Bundle v${pluginVersion} deployed successfully to ${folderName}.`)
52
+ const uploadedFile = res.file || []
53
+ console.log(`- [${uploadedFile.name}] URL:`, uploadedFile.url?.cdn)
54
+ }
55
+
56
+ return sassKey
57
+ })
58
+ .catch(console.error)
59
+ }
60
+
61
+ generateSassKey()
62
+ .then((sassKey) => deploy(sassKey).then((sassKey) => deploy(sassKey, latestFolder)))
63
+ .catch(console.error)