@atlassian/atlassian-connect-js 5.3.190

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 (190) hide show
  1. package/.depcheckrc.json +16 -0
  2. package/.editorconfig +9 -0
  3. package/.envrc +5 -0
  4. package/.eslintignore +12 -0
  5. package/.eslintrc +31 -0
  6. package/.husky/pre-commit +11 -0
  7. package/.lintstagedrc.js +6 -0
  8. package/.netrc +1 -0
  9. package/.npmrc-public +4 -0
  10. package/.nvmrc +1 -0
  11. package/LICENSE +3 -0
  12. package/README.md +281 -0
  13. package/bitbucket-pipelines.yml +33 -0
  14. package/build/bin/bin-helper.js +29 -0
  15. package/build/bin/npm-postinstall.js +9 -0
  16. package/build/configs/append-sourcemapping.js +13 -0
  17. package/build/configs/availabletasks.js +15 -0
  18. package/build/configs/clean.js +12 -0
  19. package/build/configs/concat.js +44 -0
  20. package/build/configs/copy.js +32 -0
  21. package/build/configs/index.js +19 -0
  22. package/build/configs/jshint.js +9 -0
  23. package/build/configs/karma.js +11 -0
  24. package/build/configs/replace.js +10 -0
  25. package/build/configs/requirejs.js +187 -0
  26. package/build/configs/saucelabs-launchers.js +30 -0
  27. package/build/configs/shell.js +24 -0
  28. package/build/configs/uglify.js +15 -0
  29. package/build/configs/watch.js +45 -0
  30. package/build/end.frag +13 -0
  31. package/build/start.frag +18 -0
  32. package/bundlesize.config.json +14 -0
  33. package/dist/connect-host.css +225 -0
  34. package/dist/connect-host.js +13908 -0
  35. package/dist/connect-host.min.css +1 -0
  36. package/dist/iframe-fedramp.js +13663 -0
  37. package/dist/iframe.js +13663 -0
  38. package/dist/legacy-text-colors.css +245 -0
  39. package/dist/surfaces.css +11 -0
  40. package/dist/themes/atlaskit-tokens_dark-future.css +6 -0
  41. package/dist/themes/atlaskit-tokens_dark.css +394 -0
  42. package/dist/themes/atlaskit-tokens_legacy-dark.css +394 -0
  43. package/dist/themes/atlaskit-tokens_legacy-light.css +394 -0
  44. package/dist/themes/atlaskit-tokens_light-future.css +6 -0
  45. package/dist/themes/atlaskit-tokens_light.css +394 -0
  46. package/dist/themes/atlaskit-tokens_shape.css +14 -0
  47. package/dist/themes/atlaskit-tokens_spacing.css +26 -0
  48. package/dist/themes/atlaskit-tokens_typography-adg3.css +25 -0
  49. package/dist/themes/atlaskit-tokens_typography-modernized.css +25 -0
  50. package/dist/themes/atlaskit-tokens_typography-refreshed.css +25 -0
  51. package/gulpfile.js +204 -0
  52. package/memleak-check/app.html +10 -0
  53. package/memleak-check/index.html +31 -0
  54. package/memleak-check/index.js +33 -0
  55. package/package.json +102 -0
  56. package/renovate.json +11 -0
  57. package/security-assistant.yml +2 -0
  58. package/spec/.eslintrc +10 -0
  59. package/spec/config/karma.base.conf.js +200 -0
  60. package/spec/config/karma.conf.js +20 -0
  61. package/spec/fixtures/base_dialog_component_tests.js +180 -0
  62. package/spec/mocks/mock_feature_flag.js +23 -0
  63. package/spec/tests/amd_spec.js +122 -0
  64. package/spec/tests/analytics_dispatcher_spec.js +429 -0
  65. package/spec/tests/analytics_performance_spec.js +41 -0
  66. package/spec/tests/button_spec.js +143 -0
  67. package/spec/tests/dialog_extension_spec.js +59 -0
  68. package/spec/tests/dialog_module_provider_spec.js +499 -0
  69. package/spec/tests/dialog_module_spec.js +395 -0
  70. package/spec/tests/dialog_spec.js +296 -0
  71. package/spec/tests/dialog_webitem_spec.js +183 -0
  72. package/spec/tests/dropdown_module_spec.js +77 -0
  73. package/spec/tests/env_module_spec.js +153 -0
  74. package/spec/tests/events_spec.js +77 -0
  75. package/spec/tests/extension_configuration_options_store_spec.js +25 -0
  76. package/spec/tests/flag_module_provider_spec.js +79 -0
  77. package/spec/tests/flag_module_spec.js +118 -0
  78. package/spec/tests/flag_spec.js +243 -0
  79. package/spec/tests/host-api_spec.js +220 -0
  80. package/spec/tests/iframe-create_spec.js +43 -0
  81. package/spec/tests/iframe_container_spec.js +19 -0
  82. package/spec/tests/iframe_spec.js +265 -0
  83. package/spec/tests/inline_dialog_spec.js +41 -0
  84. package/spec/tests/inline_dialog_webitem_spec.js +331 -0
  85. package/spec/tests/loading_indicator_spec.js +48 -0
  86. package/spec/tests/messages_module_spec.js +108 -0
  87. package/spec/tests/meta_spec.js +71 -0
  88. package/spec/tests/module_args_spec.js +52 -0
  89. package/spec/tests/observe_spec.js +73 -0
  90. package/spec/tests/public_events.spec.js +102 -0
  91. package/spec/tests/scroll_position_spec.js +109 -0
  92. package/spec/tests/theming_spec.js +594 -0
  93. package/spec/tests/util_spec.js +55 -0
  94. package/spec/tests/utils/base64_spec.js +20 -0
  95. package/spec/tests/utils/button_spec.js +11 -0
  96. package/spec/tests/utils/cookie_spec.js +19 -0
  97. package/spec/tests/utils/deprecate_spec.js +22 -0
  98. package/spec/tests/utils/dialog_spec.js +297 -0
  99. package/spec/tests/utils/host_util_spec.js +45 -0
  100. package/spec/tests/utils/iframe_spec.js +41 -0
  101. package/spec/tests/utils/jwt_spec.js +135 -0
  102. package/spec/tests/utils/url_spec.js +37 -0
  103. package/spec/tests/utils/waitUntilReadyNextTick.js +5 -0
  104. package/spec/tests/utils/webitem.js +219 -0
  105. package/spec/tests/webitem_spec.js +131 -0
  106. package/src/css/host/dialog.css +144 -0
  107. package/src/css/host/flags.css +5 -0
  108. package/src/css/host/host.css +64 -0
  109. package/src/css/host/messages.css +12 -0
  110. package/src/css/plugin/legacy-text-colors.less +55 -0
  111. package/src/css/plugin/surfaces.css +11 -0
  112. package/src/host/ACJSFrameworkAdaptor.js +44 -0
  113. package/src/host/actions/analytics_action.js +35 -0
  114. package/src/host/actions/button_actions.js +21 -0
  115. package/src/host/actions/dialog_actions.js +27 -0
  116. package/src/host/actions/dialog_extension_actions.js +25 -0
  117. package/src/host/actions/dom_event_actions.js +32 -0
  118. package/src/host/actions/dropdown_actions.js +12 -0
  119. package/src/host/actions/env_actions.js +57 -0
  120. package/src/host/actions/event_actions.js +33 -0
  121. package/src/host/actions/flag_actions.js +22 -0
  122. package/src/host/actions/iframe_actions.js +27 -0
  123. package/src/host/actions/inline_dialog_actions.js +26 -0
  124. package/src/host/actions/inline_dialog_webitem_actions.js +10 -0
  125. package/src/host/actions/jwt_actions.js +51 -0
  126. package/src/host/actions/loading_indicator_actions.js +10 -0
  127. package/src/host/actions/module_actions.js +14 -0
  128. package/src/host/actions/webitem_actions.js +29 -0
  129. package/src/host/components/button.js +112 -0
  130. package/src/host/components/dialog.js +447 -0
  131. package/src/host/components/dialog_extension.js +106 -0
  132. package/src/host/components/dialog_webitem.js +69 -0
  133. package/src/host/components/flag.js +102 -0
  134. package/src/host/components/iframe.js +130 -0
  135. package/src/host/components/iframe_container.js +38 -0
  136. package/src/host/components/inline_dialog.js +108 -0
  137. package/src/host/components/inline_dialog_webitem.js +157 -0
  138. package/src/host/components/loading_indicator.js +110 -0
  139. package/src/host/components/webitem.js +227 -0
  140. package/src/host/deprecate.js +20 -0
  141. package/src/host/dispatchers/analytics_dispatcher.js +512 -0
  142. package/src/host/dispatchers/event_dispatcher.js +46 -0
  143. package/src/host/dollar.js +8 -0
  144. package/src/host/host-api.js +325 -0
  145. package/src/host/iframe-create.js +7 -0
  146. package/src/host/index.js +108 -0
  147. package/src/host/module-providers.js +13 -0
  148. package/src/host/modules/_featureFlag.js +42 -0
  149. package/src/host/modules/_performance.js +54 -0
  150. package/src/host/modules/analytics.js +17 -0
  151. package/src/host/modules/dialog.js +496 -0
  152. package/src/host/modules/dropdown.js +255 -0
  153. package/src/host/modules/env.js +156 -0
  154. package/src/host/modules/events.js +28 -0
  155. package/src/host/modules/flag.js +170 -0
  156. package/src/host/modules/host.js +19 -0
  157. package/src/host/modules/inline-dialog.js +33 -0
  158. package/src/host/modules/messages.js +309 -0
  159. package/src/host/modules/page.js +29 -0
  160. package/src/host/modules/scroll-position.js +102 -0
  161. package/src/host/modules/theming.js +114 -0
  162. package/src/host/stores/extension_configuration_options_store.js +24 -0
  163. package/src/host/util.js +98 -0
  164. package/src/host/utils/access-narrowing-context.js +18 -0
  165. package/src/host/utils/base64.js +22 -0
  166. package/src/host/utils/button.js +10 -0
  167. package/src/host/utils/cookie.js +14 -0
  168. package/src/host/utils/dialog.js +239 -0
  169. package/src/host/utils/feature-flag.js +27 -0
  170. package/src/host/utils/iframe.js +23 -0
  171. package/src/host/utils/jwt.js +60 -0
  172. package/src/host/utils/observe.js +34 -0
  173. package/src/host/utils/removal-observer.js +30 -0
  174. package/src/host/utils/simplexdm.js +58 -0
  175. package/src/host/utils/url.js +23 -0
  176. package/src/host/utils/webitem.js +214 -0
  177. package/src/plugin/amd.js +115 -0
  178. package/src/plugin/analytics.js +84 -0
  179. package/src/plugin/deprecate.js +16 -0
  180. package/src/plugin/dialog.js +197 -0
  181. package/src/plugin/dollar.js +77 -0
  182. package/src/plugin/events-instance.js +2 -0
  183. package/src/plugin/events.js +246 -0
  184. package/src/plugin/extension_configuration_options_store.js +27 -0
  185. package/src/plugin/featureFlag.js +8 -0
  186. package/src/plugin/index.js +118 -0
  187. package/src/plugin/meta.js +14 -0
  188. package/src/plugin/public-events.js +73 -0
  189. package/src/plugin/theming.js +211 -0
  190. package/src/plugin/util.js +104 -0
@@ -0,0 +1,16 @@
1
+ {
2
+ "ignores": [
3
+ "@babel/*",
4
+ "@types/*",
5
+ "babel-loader",
6
+ "babel-plugin-istanbul",
7
+ "eslint",
8
+ "husky",
9
+ "jasmine-core",
10
+ "karma-*",
11
+ "less-loader",
12
+ "lint-staged",
13
+ "raw-loader"
14
+ ],
15
+ "skip-missing": false
16
+ }
package/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ indent_size = 2
7
+ indent_style = space
8
+ insert_final_newline = true
9
+ tab_width = 2
package/.envrc ADDED
@@ -0,0 +1,5 @@
1
+ PACKAGES_USERNAME=mi-ar-oi-bb-_c-58-43-9f-de-d0-46-ae-ab
2
+ PACKAGES_PASSWORD=eyJ2ZXIiOiIyIiwidHlwIjoiSldUIiwi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Oeklqb2lhbVpoWTBBd01XVjJhMlZtTVRWaE5ERjNaakF6Y0Rsa2F6WnFNR2h6ZENJc0ltVjRjQ0k2TVRjME56Y3lORGM0TWl3aWFXRjBJam94TnpRM056SXhNVGd5TENKcWRHa2lPaUl6T1RRME5EbG1ZeTAzTjJVeExUUmpPVFV0T0RrM05DMWpOREl4TTJWbE9UWXlNVFFpZlEuSzlYaFhzdWg3ZnBhbHlEY29hb0dSTHJ5cjhTUkFXUWNmWTRHU0hWUnE0U0JRbWhUN0VNbHo2RWZ1cDZhWkYydHg1VlE1a3FhaVluVWRWU2NET1BLNmwwUFNYdV9QenAzT2drSWZ6empvOEJ6Y2ZZeHQwdDhaZ3VmbVhGTzlXa0ZsdVJfRjFhZV84WHc2cnJ2NUJzR0p5WUxxNHpaSWVqYTVVVVQyTjEySjlzQnZUT2sxUzdrMmFCejNsZ19PYkY2VmU3SzFuZERGOXFqS2dnRmRXUlFCdWFGbXFYTGctVWFqZGlQbzRjMkZiVkZOUFRCNnBSdmpFcTd1bFBrTnJBclU2UEEwdXZ3aUhwZG9veUNMaUNGMXZidmpHQmo4U0RLa0NLTmtDMVNUNHdQRF94dlF2bWQ1dnpvM1RXM000MmZYcVBxWWZoMlVuZHU5aEF5c2ZRTE9BCg==
5
+ export PACKAGES_USERNAME PACKAGES_PASSWORD PACKAGES_ACCESS_TOKEN PACKAGES_PASSWORD_BASE64
package/.eslintignore ADDED
@@ -0,0 +1,12 @@
1
+ **/*.min.*
2
+ **/bower_components/**
3
+ **/lib/**
4
+ **/node_modules/**
5
+ **/target/**
6
+ .git/**
7
+ .idea/**
8
+ build/**
9
+ dist/**
10
+ test/**
11
+ memleak-check/connect-host.js
12
+ memleak-check/iframe.js
package/.eslintrc ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "parserOptions": {
3
+ "ecmaVersion": "latest",
4
+ "sourceType": "module"
5
+ },
6
+ "env": {
7
+ "es6": true,
8
+ "browser": true
9
+ },
10
+ "rules": {
11
+ "indent": [2, 2],
12
+ "brace-style": [2, "1tbs"],
13
+ "quotes": [2, "single"],
14
+ "no-unsafe-optional-chaining": "error",
15
+ // Rules from @atlassian/eslint-config-atlassian-fecq
16
+ "max-len": [1, 300, 4],
17
+ "eqeqeq": [2, "allow-null"],
18
+ "guard-for-in": 2,
19
+ "complexity": [2,15],
20
+ "max-depth": [2,4],
21
+ "no-caller": 2,
22
+ "no-undef": 2,
23
+ "no-trailing-spaces": 2,
24
+ "one-var": [2, "never"],
25
+ "curly": 2
26
+ },
27
+ "globals": {
28
+ "AJS": true,
29
+ "aui": true
30
+ }
31
+ }
@@ -0,0 +1,11 @@
1
+ npx lint-staged
2
+
3
+ # Ensure built changes are included
4
+ npm run build
5
+ if git diff --exit-code dist; then
6
+ echo "Up to date!"
7
+ else
8
+ echo "You have unbuilt dist changes that need to be committed."
9
+ echo "Please \"npm run build\" and commit the changes.";
10
+ exit 1;
11
+ fi
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ '**/*.js': () => [
3
+ 'npx gulp',
4
+ 'git add dist/*'
5
+ ]
6
+ }
package/.netrc ADDED
@@ -0,0 +1 @@
1
+ machine packages.atlassian.com login mi-ar-oi-bb-_c-58-43-9f-de-d0-46-ae-ab password eyJ2ZXIiOiIyIiwidHlwIjoiSldUIiwiYWxnIjoiUlMyNTYiLCJraWQiOiJCMGkwQWJ5YTBrWDhHcm42czFzb21oZmRnaXdZUkVSZFlVX2NrM1lHNXNFIn0.eyJzdWIiOiJqZmFjQDAxZXZrZWYxNWE0MXdmMDNwOWRrNmowaHN0L3VzZXJzL21pLWFyLW9pLWJiLV9jLTU4LTQzLTlmLWRlLWQwLTQ2LWFlLWFiIiwic2NwIjoiYXBwbGllZC1wZXJtaXNzaW9ucy9ncm91cHM6b3BlbnNvdXJjZS1wdWJsaXNoIiwiYXVkIjoiKkAqIiwiaXNzIjoiamZhY0AwMWV2a2VmMTVhNDF3ZjAzcDlkazZqMGhzdCIsImV4cCI6MTc0NzcyNDc4MiwiaWF0IjoxNzQ3NzIxMTgyLCJqdGkiOiIzOTQ0NDlmYy03N2UxLTRjOTUtODk3NC1jNDIxM2VlOTYyMTQifQ.K9XhXsuh7fpalyDcoaoGRLryr8SRAWQcfY4GSHVRq4SBQmhT7EMlz6Efup6aZF2tx5VQ5kqaiYnUdVScDOPK6l0PSXu_Pzp3OgkIfzzjo8BzcfYxt0t8ZgufmXFO9WkFluR_F1ae_8Xw6rrv5BsGJyYLq4zZIeja5UUT2N12J9sBvTOk1S7k2aBz3lg_ObF6Ve7K1ndDF9qjKggFdWRQBuaFmqXLg-UajdiPo4c2FbVFNPTB6pRvjEq7ulPkNrArU6PA0uvwiHpdooyCLiCF1vbvjGBj8SDKkCKNkC1ST4wPD_xvQvmd5vzo3TW3M42fXqPqYfh2Undu9hAysfQLOA
package/.npmrc-public ADDED
@@ -0,0 +1,4 @@
1
+ //packages.atlassian.com/api/npm/npm-public/:_password=${PACKAGES_PASSWORD_BASE64}
2
+ //packages.atlassian.com/api/npm/npm-public/:username=${PACKAGES_USERNAME}
3
+ //packages.atlassian.com/api/npm/npm-public/:email=build-team@atlassian.com
4
+ //packages.atlassian.com/api/npm/npm-public/:always-auth=true
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v18.17.0
package/LICENSE ADDED
@@ -0,0 +1,3 @@
1
+ Copyright © 2014 - 2015 Atlassian Pty Ltd.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,281 @@
1
+ Atlassian Connect JS
2
+ ====================
3
+
4
+ The javascript library which backs [Atlassian Connect](https://developer.atlassian.com/cloud/jira/platform/getting-started-with-connect).
5
+
6
+ Based on [Simple XDM](https://bitbucket.org/atlassian/simple-xdm/)
7
+
8
+ ![Bitbucket Pipelines build status](https://img.shields.io/bitbucket/pipelines/atlassian/atlassian-connect-js/master)
9
+
10
+ Hello API example
11
+ -----------------------
12
+
13
+ Modules allow you to expose new connect API's to add-on iframes.
14
+ ```javascript
15
+ connectHost.defineModule('example', {
16
+ sayHello: function(name){ alert('hello ' + name); }
17
+ });
18
+ ```
19
+
20
+ An add-on may now call:
21
+ ```javascript
22
+ AP.example.sayHello('fred');
23
+ ```
24
+ which will create an alert with "hello fred"
25
+
26
+
27
+ Hello event example
28
+ -----------------------
29
+
30
+ Events are used when a callback needs to be called multiple times.
31
+ ```javascript
32
+ var eventName = 'hello';
33
+ // addonFilter can be a filter function or object to match against add-ons (a blank object denotes sending to all add-ons).
34
+ var addonFilter = {
35
+ addon_key: 'my-addon',
36
+ key: 'my-module-key'
37
+ };
38
+ var eventData = {
39
+ name: 'fred'
40
+ };
41
+ connectHost.broadcastEvent(eventName, addonFilter, eventData);
42
+ ```
43
+
44
+ An addon may listen with:
45
+ ```javascript
46
+ AP.register({
47
+ hello: function(name){ alert('hello ' + name); }
48
+ });
49
+ ```
50
+ which will create an alert with "hello fred"
51
+
52
+
53
+ Listening to keystrokes example
54
+ -------------------------------
55
+ Keyboard events are only sent to the currently focused frame. To allow a more seamless experience for users we allow a convenient way to listen for events inside an iframe.
56
+
57
+ ```javascript
58
+ var extension_id = 'addon_key__module_key__ab1j4';
59
+ var escapeKeyKeycode = 27;
60
+ var keymodifiers = [];
61
+ function callback(data) {
62
+ /** data = {
63
+ * extension_id: addon_key__module_key__ab1j4
64
+ * addon_key
65
+ * key
66
+ * keycode: 27
67
+ * modifiers: []
68
+ * }
69
+ */
70
+
71
+ alert(data.keycode + ' key pressed inside add-on iframe');
72
+ }
73
+ // an iframe must load before you can bind to it.
74
+ connectHost.onIframeEstablished(function(extension){
75
+ connectHost.onKeyEvent(extension.extension_id, escapeKeyKeycode, callback);
76
+ });
77
+ ```
78
+
79
+ Advanced Modules
80
+ -----------------------
81
+ Some times you need a more complex API than simple RPC -> callback.
82
+ You can define a Class module which will create a proxy class in the add-on.
83
+
84
+ ```javascript
85
+ class Foo {
86
+ constructor(foo) {
87
+ this.foo = foo;
88
+ }
89
+ getFoo(cb) {
90
+ if (typeof cb === 'function') {
91
+ cb(this.foo);
92
+ }
93
+ }
94
+ };
95
+ host.defineModule('moduleWithClass', {
96
+ foo: {
97
+ constructor: Foo, // Class must be destructured in API spec
98
+ getFoo: Foo.prototype.getFoo
99
+ }
100
+ });
101
+ ```
102
+
103
+ The addon can then use the proxy to call methods on an instance of your host class:
104
+ ```javascript
105
+ var bar = AP.moduleWithClass.foo('bar');
106
+ bar.getFoo(function (foo) {
107
+ console.log(foo);
108
+ });
109
+ ```
110
+
111
+ Lifecycle
112
+ ---------
113
+
114
+ * connectHost.onIframeEstablished - a callback triggered when an iframe successfully contacts the parent page.
115
+ * connectHost.onIframeUnload - a callback triggered when window.onunload is called inside the iframe.
116
+ * connectHost.destroy - call this to clean up destroyed connect add-ons - helpful for SPA web apps that need to free memory.
117
+
118
+
119
+ JWT and the content resolver
120
+ ---
121
+
122
+ There are instances when a connect add-on is created but the URL is unknown (or if you use JWT, that it's expired).
123
+
124
+ In these instances you can register a function to delegate to. Connect will call this function and wait before creating the iframe until it has responded - usually requiring your application to callback to your server.
125
+ The example below uses jQuery promises, but any promise library should work (note: jQuery.ajax also returns a promise).
126
+
127
+ ```javascript
128
+ function contentResolver(extension) {
129
+ var promise = jQuery.Deferred(function(defer){
130
+ // do some work here, then resolve to what would be passed to connectHost.create
131
+ defer.resolve({
132
+ url: 'the full iframe url from the server',
133
+ addon_key: 'my-addon-key',
134
+ key: 'my-module-key',
135
+ options: {} // same options as connectHost.create({options:{}})
136
+ });
137
+ }).promise();
138
+ return promise;
139
+ }
140
+
141
+ connectHost.registerContentResolver.resolveByExtension(contentResolver);
142
+ ```
143
+
144
+ Analytics
145
+ ---
146
+
147
+ You can expose an analytics event reciever as follows:
148
+
149
+ ```javascript
150
+ define('ac/analytics', () => {
151
+ return {
152
+ emitGasV3: (eventType, eventData) => {
153
+ console.log('this is an alaytics event', eventType, eventData);
154
+ }
155
+ };
156
+ });
157
+ ```
158
+
159
+ Requirements
160
+ ------------
161
+
162
+ - Node LTS (refer to `.nvmrc`)
163
+ - NPM
164
+
165
+ Installation
166
+ ------------
167
+
168
+ NPM install takes care of everything for you.
169
+
170
+ npm install
171
+
172
+ Building
173
+ --------
174
+
175
+ To build the distribution:
176
+
177
+ npm run build
178
+
179
+ Running tests
180
+ -------------
181
+
182
+ We use [Karma](https://karma-runner.github.io/latest/index.html) for running our [Jasmine](https://jasmine.github.io/) tests.
183
+
184
+ To run tests in watch mode:
185
+
186
+ npm run karma
187
+
188
+ Running tests with saucelabs
189
+ ----------------------------
190
+
191
+ Tests are automatically run in Sauce Labs from Bitbucket Pipelines. They run using all supported browsers. You can run these yourself as follows:
192
+
193
+ Set your Sauce Labs credentials using the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables.
194
+
195
+ Then run the tests using:
196
+
197
+ SAUCE_LABS=true npm test
198
+
199
+ Alternatively you can enter Sauce Labs credentials at run time with:
200
+
201
+ SAUCE_LABS=true SAUCE_USERNAME=XXXXX SAUCE_ACCESS_KEY=XXXXX npm test
202
+
203
+ Linting && Coding Style Checks
204
+ ------------------------------
205
+
206
+ ACJS follows the Atlassian Front-End Code Quality guidelines.
207
+
208
+ npm run lint
209
+
210
+ Point IntelliJ / Sublime / your editor of choice at the .eslintrc for linting as you edit.
211
+
212
+ Code Coverage
213
+ -------------
214
+
215
+ We use [Istanbul](https://istanbul.js.org/) for code coverage statistics.
216
+
217
+ To run tests and generate coverage results:
218
+
219
+ COVERAGE=true npm run karma-ci
220
+
221
+ Then point your browser at:
222
+
223
+ file:///<path to atlassian-connect-js>/coverage/index.html
224
+
225
+ Commands
226
+ --------
227
+
228
+ To see a wider range of gulp commands run:
229
+
230
+ gulp --tasks
231
+
232
+ Dev loop
233
+ --------
234
+
235
+ To automatically re-create the dist directory on code change, run:
236
+
237
+ gulp watch
238
+
239
+ To have your changes automatically loaded onto a locally running JIRA or Confluence instance, first make sure that you
240
+ include `-Dconnect-js-v5=true` in your command to start the product. Then you can deploy the contents of your dist directory:
241
+
242
+ gulp deploy
243
+
244
+ By default, this will deploy to the v5 resources directory inside your local `atlassian-connect` project, i.e.
245
+ `/<path/to/my/projects>/atlassian-connect/jsapi-v5/src/main/resources/v5`. Changes will be automatically picked up by the
246
+ running product.
247
+
248
+ Contributing
249
+ ------------
250
+ Contributions are welcome! However, the versions and branches of this project are in a state of flux. Before starting work,
251
+ please contact the Atlassian Connect team to ensure you understand the process you'll need to follow.
252
+
253
+ 1. Create an issue in the [Atlassian Connect JavaScript API project](https://ecosystem.atlassian.net/browse/ACJS).
254
+ 2. Create your feature branch off `master`.
255
+ * Include your issue key and a short description.
256
+ 3. Push your changes.
257
+ 4. Create a pull request against this repository.
258
+ 5. If your changes will affect the functionality of the Connect plugin, create a feature branch in the product and make sure the build is green against your ACJS branch by updating the version consumed by the product.
259
+
260
+
261
+ Releasing a new version
262
+ ------------------------
263
+ This is now done via BitBucket Pipelines on the master branch.
264
+
265
+ The `onecloud-build-bot` account executes this step as via the OAuth method described by [these Bitbucket instructions](
266
+ https://support.atlassian.com/bitbucket-cloud/docs/push-back-to-your-repository/)
267
+
268
+
269
+ If you're an Atlassian developer and you wish to release a new version of Atlassian Connect JS for Atlassian products to use,
270
+ follow [this HOWTO](https://hello.atlassian.net/wiki/spaces/ECO/pages/1473343850/HOW-TO+Release+ACJS+for+products).
271
+
272
+
273
+ Compatibility
274
+ -------------
275
+ Atlassian Connect supports the following browsers:
276
+
277
+ - Chrome latest stable
278
+ - Firefox latest stable
279
+ - Safari latest stable (on OS X only)
280
+
281
+
@@ -0,0 +1,33 @@
1
+ image: node:18
2
+
3
+ pipelines:
4
+ branches:
5
+ master:
6
+ - step:
7
+ name: Publish to Atlassian Artifactory
8
+ oidc: true
9
+ script:
10
+ - pipe: docker://atlassian/packages-oidc-pipe:latest
11
+ - source .envrc
12
+ - apt-get update && apt-get install -y jq
13
+ - npm ci # prepublish/build also runs at this stage
14
+ - NODE_OPTIONS=--openssl-legacy-provider npm run test-sl
15
+ - echo "Publishing to Atlassian Artifactory npm-public..."
16
+ - npm publish --ddd --userconfig=./.npmrc-public --@atlassian/atlassian-connect-js:registry="https://packages.atlassian.com/api/npm/npm-public/"
17
+
18
+ default:
19
+ - step:
20
+ name: Test
21
+ script:
22
+ - npm set //registry.npmjs.org/:_authToken=$NPM_PUBLISH_TOKEN
23
+ - npm ci # prepublish/build also runs at this stage
24
+ - >-
25
+ if git diff --exit-code dist; then
26
+ echo "Up to date!"
27
+ else
28
+ echo "You have unbuilt dist changes that need to be committed."
29
+ echo "Please \"npm run build\" and commit the changes.";
30
+ exit 1;
31
+ fi
32
+ - npm run bundlesize
33
+ - NODE_OPTIONS=--openssl-legacy-provider npm run test-sl
@@ -0,0 +1,29 @@
1
+ var spawn = require('child_process').spawn;
2
+ var normalizePath = require('path').normalize;
3
+ var isWin = require('os').platform() === 'win32';
4
+
5
+ exports.chain = function chain(commands) {
6
+ if (commands.length) {
7
+ var cmd = commands.shift();
8
+ var opts;
9
+ if(cmd.length > 2 || !(cmd[1] instanceof Array)) {
10
+ opts = cmd[cmd.length - 1];
11
+ } else {
12
+ cmd.push(opts = {});
13
+ }
14
+ opts.stdio = 'inherit';
15
+ opts.env = process.env;
16
+
17
+ var args = cmd[1] && cmd[1].join && cmd[1].join(' ') || '';
18
+ console.log('Running ' + cmd[0] + ' ' + args);
19
+
20
+ var proc = spawn.apply(null, cmd);
21
+ proc.on('error', console.log.bind(console, cmd));
22
+ proc.on('close', chain.bind(null, commands));
23
+ }
24
+ };
25
+
26
+ exports.pathNormalize = normalizePath;
27
+ exports.npmNormalize = function(str) {
28
+ return normalizePath(str) + (isWin ? '.cmd' : '');
29
+ };
@@ -0,0 +1,9 @@
1
+ var helper = require('./bin-helper');
2
+
3
+ helper.chain([
4
+ [helper.npmNormalize('./node_modules/.bin/bower'), ['install']],
5
+ [helper.npmNormalize('./node_modules/grunt-cli/bin/grunt'),
6
+ ['--gruntfile', helper.npmNormalize('./Gruntfile.js'), 'build']
7
+ ]
8
+
9
+ ]);
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ host: {
3
+ files: {
4
+ '.tmp/host.js' : 'host.map'
5
+ }
6
+ },
7
+ plugin: {
8
+ files: {
9
+ '.tmp/all.js' : 'all.map'
10
+ }
11
+
12
+ }
13
+ };
@@ -0,0 +1,15 @@
1
+ module.exports = {
2
+ options: {
3
+ filter: 'include',
4
+ tasks: [
5
+ 'build',
6
+ 'clean',
7
+ 'lint',
8
+ 'test',
9
+ 'test-all',
10
+ 'test-debug',
11
+ 'test-dist'
12
+ ]
13
+ },
14
+ all: {}
15
+ };
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ dist: [
3
+ 'dist'
4
+ ],
5
+ tmp: [
6
+ '.tmp'
7
+ ],
8
+ deps: [
9
+ 'node_modules',
10
+ 'bower_components'
11
+ ]
12
+ };
@@ -0,0 +1,44 @@
1
+ module.exports = {
2
+ options: {
3
+ stripBanners: true,
4
+ banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today('yyyy-mm-dd') %> */\n\n',
5
+ nonull: true
6
+ },
7
+ hostcss: {
8
+ src: [
9
+ '<%= paths.cssSource %>' + 'iframe/host.css',
10
+ '<%= paths.cssSource %>' + 'messages/main.css',
11
+ '<%= paths.cssSource %>' + 'dialog/dialog.css'
12
+ ],
13
+ dest: '.tmp/host-css.css',
14
+ nonull: true
15
+ },
16
+ /**
17
+ * If the file references AP (without _ before it). Include it in the plugin
18
+ */
19
+ plugin: {
20
+ src: [
21
+ '<%= paths.jsSource %>' + 'iframe/_amd.js',
22
+ '<%= paths.jsSource %>' + 'iframe/plugin/_util.js',
23
+ '<%= paths.jsSource %>' + 'iframe/plugin/_dollar.js',
24
+ '<%= paths.jsSource %>' + 'iframe/_events.js',
25
+ '<%= paths.jsSource %>' + 'iframe/_base64.js',
26
+ '<%= paths.jsSource %>' + 'iframe/_uri.js',
27
+ '<%= paths.jsSource %>' + 'iframe/_ui-params.js',
28
+ '<%= paths.jsSource %>' + 'iframe/_jwt.js',
29
+ '<%= paths.jsSource %>' + 'iframe/_xdm.js',
30
+ '<%= paths.jsSource %>' + 'iframe/plugin/_rpc.js',
31
+ '<%= paths.jsSource %>' + 'iframe/plugin/events.js',
32
+ '<%= paths.jsSource %>' + 'iframe/plugin/env.js',
33
+ '<%= paths.jsSource %>' + 'iframe/plugin/request.js',
34
+ '<%= paths.jsSource %>' + 'iframe/plugin/dialog.js',
35
+ '<%= paths.jsSource %>' + 'iframe/plugin/inline-dialog.js',
36
+ '<%= paths.jsSource %>' + 'iframe/plugin/messages.js',
37
+ '<%= paths.jsSource %>' + 'iframe/plugin/cookie.js',
38
+ '<%= paths.jsSource %>' + 'iframe/plugin/history.js',
39
+ '<%= paths.jsSource %>' + 'iframe/plugin/_resize_listener.js'
40
+ ],
41
+ dest: '.tmp/all-debug.js',
42
+ nonull: true
43
+ }
44
+ };
@@ -0,0 +1,32 @@
1
+ module.exports = {
2
+ disthostjs: {
3
+ files: [{
4
+ cwd: '<%= paths.tmp %>amd-stubs',
5
+ dest: '<%= paths.dist %>',
6
+ expand: true,
7
+ filter: 'isFile',
8
+ src: ['**.js',
9
+ '!*.report.txt']
10
+ }]
11
+ },
12
+ distpluginjs: {
13
+ files: [{
14
+ cwd: '<%= paths.tmp %>',
15
+ dest: '<%= paths.dist %>',
16
+ expand: true,
17
+ filter: 'isFile',
18
+ src: ['all.js', 'all-debug.js',
19
+ '!*.report.txt']
20
+ }]
21
+ },
22
+ distcss: {
23
+ files: [{
24
+ cwd: '<%= paths.tmp %>',
25
+ dest: '<%= paths.dist %>',
26
+ expand: true,
27
+ filter: 'isFile',
28
+ src: ['**.css',
29
+ '!*.report.txt']
30
+ }]
31
+ }
32
+ };
@@ -0,0 +1,19 @@
1
+ var fs = require('fs');
2
+ var path = require('path');
3
+
4
+ module.exports = function (grunt) {
5
+ var configs = {};
6
+
7
+ fs.readdirSync(__dirname).forEach(function(file) {
8
+ if (file === 'index.js') {
9
+ return;
10
+ }
11
+
12
+ var name = path.basename(file, '.js');
13
+ var conf = require('./' + name);
14
+
15
+ configs[name] = typeof conf === 'function' ? conf(grunt) : conf;
16
+ });
17
+
18
+ return configs;
19
+ };
@@ -0,0 +1,9 @@
1
+ module.exports = {
2
+ options: {
3
+ jshintrc: '.jshintrc'
4
+ },
5
+ all: [
6
+ 'Gruntfile.js',
7
+ 'src/js/{*,**/*}'
8
+ ]
9
+ };
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ options: {
3
+ singleRun: true
4
+ },
5
+ host: {
6
+ configFile: 'karma.conf.js'
7
+ },
8
+ plugin: {
9
+ configFile: 'karma.iframe.conf.js'
10
+ }
11
+ };
@@ -0,0 +1,10 @@
1
+ module.exports = {
2
+ projectVersion:{
3
+ src: ['dist/**/*.js', 'dist/**/*.html', 'dist/**/*.css'],
4
+ overwrite: true,
5
+ replacements: [{
6
+ from: /\${project.version}/,
7
+ to: '<%= pkg.version %>'
8
+ }]
9
+ }
10
+ };