@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.
- package/.depcheckrc.json +16 -0
- package/.editorconfig +9 -0
- package/.envrc +5 -0
- package/.eslintignore +12 -0
- package/.eslintrc +31 -0
- package/.husky/pre-commit +11 -0
- package/.lintstagedrc.js +6 -0
- package/.netrc +1 -0
- package/.npmrc-public +4 -0
- package/.nvmrc +1 -0
- package/LICENSE +3 -0
- package/README.md +281 -0
- package/bitbucket-pipelines.yml +33 -0
- package/build/bin/bin-helper.js +29 -0
- package/build/bin/npm-postinstall.js +9 -0
- package/build/configs/append-sourcemapping.js +13 -0
- package/build/configs/availabletasks.js +15 -0
- package/build/configs/clean.js +12 -0
- package/build/configs/concat.js +44 -0
- package/build/configs/copy.js +32 -0
- package/build/configs/index.js +19 -0
- package/build/configs/jshint.js +9 -0
- package/build/configs/karma.js +11 -0
- package/build/configs/replace.js +10 -0
- package/build/configs/requirejs.js +187 -0
- package/build/configs/saucelabs-launchers.js +30 -0
- package/build/configs/shell.js +24 -0
- package/build/configs/uglify.js +15 -0
- package/build/configs/watch.js +45 -0
- package/build/end.frag +13 -0
- package/build/start.frag +18 -0
- package/bundlesize.config.json +14 -0
- package/dist/connect-host.css +225 -0
- package/dist/connect-host.js +13908 -0
- package/dist/connect-host.min.css +1 -0
- package/dist/iframe-fedramp.js +13663 -0
- package/dist/iframe.js +13663 -0
- package/dist/legacy-text-colors.css +245 -0
- package/dist/surfaces.css +11 -0
- package/dist/themes/atlaskit-tokens_dark-future.css +6 -0
- package/dist/themes/atlaskit-tokens_dark.css +394 -0
- package/dist/themes/atlaskit-tokens_legacy-dark.css +394 -0
- package/dist/themes/atlaskit-tokens_legacy-light.css +394 -0
- package/dist/themes/atlaskit-tokens_light-future.css +6 -0
- package/dist/themes/atlaskit-tokens_light.css +394 -0
- package/dist/themes/atlaskit-tokens_shape.css +14 -0
- package/dist/themes/atlaskit-tokens_spacing.css +26 -0
- package/dist/themes/atlaskit-tokens_typography-adg3.css +25 -0
- package/dist/themes/atlaskit-tokens_typography-modernized.css +25 -0
- package/dist/themes/atlaskit-tokens_typography-refreshed.css +25 -0
- package/gulpfile.js +204 -0
- package/memleak-check/app.html +10 -0
- package/memleak-check/index.html +31 -0
- package/memleak-check/index.js +33 -0
- package/package.json +102 -0
- package/renovate.json +11 -0
- package/security-assistant.yml +2 -0
- package/spec/.eslintrc +10 -0
- package/spec/config/karma.base.conf.js +200 -0
- package/spec/config/karma.conf.js +20 -0
- package/spec/fixtures/base_dialog_component_tests.js +180 -0
- package/spec/mocks/mock_feature_flag.js +23 -0
- package/spec/tests/amd_spec.js +122 -0
- package/spec/tests/analytics_dispatcher_spec.js +429 -0
- package/spec/tests/analytics_performance_spec.js +41 -0
- package/spec/tests/button_spec.js +143 -0
- package/spec/tests/dialog_extension_spec.js +59 -0
- package/spec/tests/dialog_module_provider_spec.js +499 -0
- package/spec/tests/dialog_module_spec.js +395 -0
- package/spec/tests/dialog_spec.js +296 -0
- package/spec/tests/dialog_webitem_spec.js +183 -0
- package/spec/tests/dropdown_module_spec.js +77 -0
- package/spec/tests/env_module_spec.js +153 -0
- package/spec/tests/events_spec.js +77 -0
- package/spec/tests/extension_configuration_options_store_spec.js +25 -0
- package/spec/tests/flag_module_provider_spec.js +79 -0
- package/spec/tests/flag_module_spec.js +118 -0
- package/spec/tests/flag_spec.js +243 -0
- package/spec/tests/host-api_spec.js +220 -0
- package/spec/tests/iframe-create_spec.js +43 -0
- package/spec/tests/iframe_container_spec.js +19 -0
- package/spec/tests/iframe_spec.js +265 -0
- package/spec/tests/inline_dialog_spec.js +41 -0
- package/spec/tests/inline_dialog_webitem_spec.js +331 -0
- package/spec/tests/loading_indicator_spec.js +48 -0
- package/spec/tests/messages_module_spec.js +108 -0
- package/spec/tests/meta_spec.js +71 -0
- package/spec/tests/module_args_spec.js +52 -0
- package/spec/tests/observe_spec.js +73 -0
- package/spec/tests/public_events.spec.js +102 -0
- package/spec/tests/scroll_position_spec.js +109 -0
- package/spec/tests/theming_spec.js +594 -0
- package/spec/tests/util_spec.js +55 -0
- package/spec/tests/utils/base64_spec.js +20 -0
- package/spec/tests/utils/button_spec.js +11 -0
- package/spec/tests/utils/cookie_spec.js +19 -0
- package/spec/tests/utils/deprecate_spec.js +22 -0
- package/spec/tests/utils/dialog_spec.js +297 -0
- package/spec/tests/utils/host_util_spec.js +45 -0
- package/spec/tests/utils/iframe_spec.js +41 -0
- package/spec/tests/utils/jwt_spec.js +135 -0
- package/spec/tests/utils/url_spec.js +37 -0
- package/spec/tests/utils/waitUntilReadyNextTick.js +5 -0
- package/spec/tests/utils/webitem.js +219 -0
- package/spec/tests/webitem_spec.js +131 -0
- package/src/css/host/dialog.css +144 -0
- package/src/css/host/flags.css +5 -0
- package/src/css/host/host.css +64 -0
- package/src/css/host/messages.css +12 -0
- package/src/css/plugin/legacy-text-colors.less +55 -0
- package/src/css/plugin/surfaces.css +11 -0
- package/src/host/ACJSFrameworkAdaptor.js +44 -0
- package/src/host/actions/analytics_action.js +35 -0
- package/src/host/actions/button_actions.js +21 -0
- package/src/host/actions/dialog_actions.js +27 -0
- package/src/host/actions/dialog_extension_actions.js +25 -0
- package/src/host/actions/dom_event_actions.js +32 -0
- package/src/host/actions/dropdown_actions.js +12 -0
- package/src/host/actions/env_actions.js +57 -0
- package/src/host/actions/event_actions.js +33 -0
- package/src/host/actions/flag_actions.js +22 -0
- package/src/host/actions/iframe_actions.js +27 -0
- package/src/host/actions/inline_dialog_actions.js +26 -0
- package/src/host/actions/inline_dialog_webitem_actions.js +10 -0
- package/src/host/actions/jwt_actions.js +51 -0
- package/src/host/actions/loading_indicator_actions.js +10 -0
- package/src/host/actions/module_actions.js +14 -0
- package/src/host/actions/webitem_actions.js +29 -0
- package/src/host/components/button.js +112 -0
- package/src/host/components/dialog.js +447 -0
- package/src/host/components/dialog_extension.js +106 -0
- package/src/host/components/dialog_webitem.js +69 -0
- package/src/host/components/flag.js +102 -0
- package/src/host/components/iframe.js +130 -0
- package/src/host/components/iframe_container.js +38 -0
- package/src/host/components/inline_dialog.js +108 -0
- package/src/host/components/inline_dialog_webitem.js +157 -0
- package/src/host/components/loading_indicator.js +110 -0
- package/src/host/components/webitem.js +227 -0
- package/src/host/deprecate.js +20 -0
- package/src/host/dispatchers/analytics_dispatcher.js +512 -0
- package/src/host/dispatchers/event_dispatcher.js +46 -0
- package/src/host/dollar.js +8 -0
- package/src/host/host-api.js +325 -0
- package/src/host/iframe-create.js +7 -0
- package/src/host/index.js +108 -0
- package/src/host/module-providers.js +13 -0
- package/src/host/modules/_featureFlag.js +42 -0
- package/src/host/modules/_performance.js +54 -0
- package/src/host/modules/analytics.js +17 -0
- package/src/host/modules/dialog.js +496 -0
- package/src/host/modules/dropdown.js +255 -0
- package/src/host/modules/env.js +156 -0
- package/src/host/modules/events.js +28 -0
- package/src/host/modules/flag.js +170 -0
- package/src/host/modules/host.js +19 -0
- package/src/host/modules/inline-dialog.js +33 -0
- package/src/host/modules/messages.js +309 -0
- package/src/host/modules/page.js +29 -0
- package/src/host/modules/scroll-position.js +102 -0
- package/src/host/modules/theming.js +114 -0
- package/src/host/stores/extension_configuration_options_store.js +24 -0
- package/src/host/util.js +98 -0
- package/src/host/utils/access-narrowing-context.js +18 -0
- package/src/host/utils/base64.js +22 -0
- package/src/host/utils/button.js +10 -0
- package/src/host/utils/cookie.js +14 -0
- package/src/host/utils/dialog.js +239 -0
- package/src/host/utils/feature-flag.js +27 -0
- package/src/host/utils/iframe.js +23 -0
- package/src/host/utils/jwt.js +60 -0
- package/src/host/utils/observe.js +34 -0
- package/src/host/utils/removal-observer.js +30 -0
- package/src/host/utils/simplexdm.js +58 -0
- package/src/host/utils/url.js +23 -0
- package/src/host/utils/webitem.js +214 -0
- package/src/plugin/amd.js +115 -0
- package/src/plugin/analytics.js +84 -0
- package/src/plugin/deprecate.js +16 -0
- package/src/plugin/dialog.js +197 -0
- package/src/plugin/dollar.js +77 -0
- package/src/plugin/events-instance.js +2 -0
- package/src/plugin/events.js +246 -0
- package/src/plugin/extension_configuration_options_store.js +27 -0
- package/src/plugin/featureFlag.js +8 -0
- package/src/plugin/index.js +118 -0
- package/src/plugin/meta.js +14 -0
- package/src/plugin/public-events.js +73 -0
- package/src/plugin/theming.js +211 -0
- package/src/plugin/util.js +104 -0
package/.depcheckrc.json
ADDED
package/.editorconfig
ADDED
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=eyJ2ZXIiOiIyIiwidHlwIjoiSldUIiwiYWxnIjoiUlMyNTYiLCJraWQiOiJCMGkwQWJ5YTBrWDhHcm42czFzb21oZmRnaXdZUkVSZFlVX2NrM1lHNXNFIn0.eyJzdWIiOiJqZmFjQDAxZXZrZWYxNWE0MXdmMDNwOWRrNmowaHN0L3VzZXJzL21pLWFyLW9pLWJiLV9jLTU4LTQzLTlmLWRlLWQwLTQ2LWFlLWFiIiwic2NwIjoiYXBwbGllZC1wZXJtaXNzaW9ucy9ncm91cHM6b3BlbnNvdXJjZS1wdWJsaXNoIiwiYXVkIjoiKkAqIiwiaXNzIjoiamZhY0AwMWV2a2VmMTVhNDF3ZjAzcDlkazZqMGhzdCIsImV4cCI6MTc0NzcyNDc4MiwiaWF0IjoxNzQ3NzIxMTgyLCJqdGkiOiIzOTQ0NDlmYy03N2UxLTRjOTUtODk3NC1jNDIxM2VlOTYyMTQifQ.K9XhXsuh7fpalyDcoaoGRLryr8SRAWQcfY4GSHVRq4SBQmhT7EMlz6Efup6aZF2tx5VQ5kqaiYnUdVScDOPK6l0PSXu_Pzp3OgkIfzzjo8BzcfYxt0t8ZgufmXFO9WkFluR_F1ae_8Xw6rrv5BsGJyYLq4zZIeja5UUT2N12J9sBvTOk1S7k2aBz3lg_ObF6Ve7K1ndDF9qjKggFdWRQBuaFmq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RTE9BCg==
|
|
5
|
+
export PACKAGES_USERNAME PACKAGES_PASSWORD PACKAGES_ACCESS_TOKEN PACKAGES_PASSWORD_BASE64
|
package/.eslintignore
ADDED
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
|
package/.lintstagedrc.js
ADDED
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
|
+

|
|
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,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
|
+
};
|