-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAgoraLib.js.html
765 lines (650 loc) · 33.5 KB
/
AgoraLib.js.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Adobe CEP8 API Source: AgoraLib.js</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.united.css">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top navbar-inverse">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">Adobe CEP8 API</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="topNavigation">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="cep.html">cep</a></li><li><a href="cep.encoding.html">cep.encoding</a></li><li><a href="cep.encoding.convertion.html">cep.encoding.convertion</a></li><li><a href="cep.fs.html">cep.fs</a></li><li><a href="cep.process.html">cep.process</a></li><li><a href="cep.util.html">cep.util</a></li>
</ul>
</li>
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="AgoraLib.html">AgoraLib</a></li><li><a href="ApiVersion.html">ApiVersion</a></li><li><a href="AppSkinInfo.html">AppSkinInfo</a></li><li><a href="ColorType.html">ColorType</a></li><li><a href="ContextMenuItemStatus.html">ContextMenuItemStatus</a></li><li><a href="CSEvent.html">CSEvent</a></li><li><a href="CSInterface.html">CSInterface</a></li><li><a href="Direction.html">Direction</a></li><li><a href="Extension.html">Extension</a></li><li><a href="GradientColor.html">GradientColor</a></li><li><a href="GradientStop.html">GradientStop</a></li><li><a href="HostCapabilities.html">HostCapabilities</a></li><li><a href="HostEnvironment.html">HostEnvironment</a></li><li><a href="MenuItemStatus.html">MenuItemStatus</a></li><li><a href="RGBColor.html">RGBColor</a></li><li><a href="Runtime.html">Runtime</a></li><li><a href="SystemPath.html">SystemPath</a></li><li><a href="UIColor.html">UIColor</a></li><li><a href="Version.html">Version</a></li><li><a href="VersionBound.html">VersionBound</a></li><li><a href="VersionRange.html">VersionRange</a></li><li><a href="Vulcan.html">Vulcan</a></li><li><a href="VulcanMessage.html">VulcanMessage</a></li>
</ul>
</li>
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="global.html#AgoraLibResponse">AgoraLibResponse</a></li><li><a href="global.html#CSXSWindowType">CSXSWindowType</a></li><li><a href="global.html#EvalScript_ErrMessage">EvalScript_ErrMessage</a></li><li><a href="global.html#GetValueByKey">GetValueByKey</a></li><li><a href="global.html#requiredParamsValid">requiredParamsValid</a></li><li><a href="global.html#strStartsWith">strStartsWith</a></li><li><a href="global.html#VulcanInterface">VulcanInterface</a></li>
</ul>
</li>
</ul>
<div class="col-sm-3 col-md-3">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
<div class="input-group-btn">
<button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="container" id="toc-content">
<div class="row">
<div class="col-md-12">
<div id="main">
<h1 class="page-title">Source: AgoraLib.js</h1>
<section>
<article>
<pre
class="sunlight-highlight-javascript linenums">/**************************************************************************************************
*
* ADOBE SYSTEMS INCORPORATED
* Copyright 2014 Adobe Systems Incorporated
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the
* terms of the Adobe license agreement accompanying it. If you have received this file from a
* source other than Adobe, then your use, modification, or distribution of it requires the prior
* written permission of Adobe.
*
**************************************************************************************************/
/** AgoraLib - v7.0.0 */
/**
* @class AgoraLib
*
* AgoraLib provides an interface to the Adobe Exchange service and Exchange plugin.
* Please note that Vulcan.js is required.
*/
function AgoraLib() {
var extensionID = window.__adobe_cep__.getExtensionId();
// GUID discussions: http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
var guid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);return v.toString(16);});
var that = this;
var exchangeVersion;
this.callerID = guid + '_' + extensionID;
this.bundleID = window.__adobe_cep__.invokeSync("getBundleId", "");
//--------------------------------------- Private functions ------------------------------
this.responseCallback = function (message) {
if (window.DOMParser) {
var parser = new window.DOMParser();
try {
var xmlDoc = parser.parseFromString(message.data, "text/xml");
var payloadNode = xmlDoc.getElementsByTagName("payload")[0];
if (payloadNode && payloadNode.childNodes[0]) {
payloadNode = payloadNode.childNodes[0].nodeValue;
}
if (payloadNode !== null) {
payloadNode = cep.encoding.convertion.b64_to_utf8(payloadNode);
}
console.log("Decoded payload: " + payloadNode);
var payloadDoc = parser.parseFromString(payloadNode, "text/xml");
var responses = payloadDoc.getElementsByTagName("Response");
for (var i = 0; i < responses.length; i++) {
var respElem = responses[i];
if (respElem) {
var apiName = respElem.attributes.getNamedItem("name").nodeValue;
var callerID = respElem.attributes.getNamedItem("callerID").nodeValue;
console.log("This caller ID " + that.callerID + " received caller ID " + callerID);
console.log("API: " + apiName);
if (callerID === that.callerID) {
console.log("CallerIDs match! Now removing message listener");
VulcanInterface.removeMessageListener(AgoraLib.RESPONSE_TYPE, that.responseCallback);
// extract parameters
var respParams = respElem.getElementsByTagName("Result");
var params = {};
for (var j = 0; j < respParams.length; j++) {
var paramName = respParams[j].attributes.getNamedItem("name").nodeValue;
var paramValue = respParams[j].getElementsByTagName("Value")[0].textContent;
console.log("param name: " + paramName + " param value: " + paramValue);
params[paramName] = paramValue;
}
if (apiName === AgoraLib.IS_ENTITLED) {
console.log("IsEntitled callback");
var response1 = new AgoraLibResponse(params[AgoraLib.IS_ENTITLED], params[AgoraLib.STATUS], params[AgoraLib.STATUSCODE]);
that.isEntitledCallback(response1);
} else if (apiName === AgoraLib.GET_PURCHASE_URL) {
console.log("GetPurchaseUrl callback");
var url = params.URL;
var response2 = new AgoraLibResponse(url, params[AgoraLib.STATUS], params[AgoraLib.STATUSCODE]);
that.getPurchaseUrlCallback(response2);
} else if (apiName === AgoraLib.GET_VERSION) {
console.log("GetVersion callback");
var response3 = new AgoraLibResponse(params.Version, params[AgoraLib.STATUS], params[AgoraLib.STATUSCODE]);
that.exchangeVersion = params.Version;
that.getVersionCallback(response3);
} else if (apiName === AgoraLib.CREATE_ENTITLEMENT) {
console.log("CreateEntitlement callback");
var response4 = new AgoraLibResponse("", params[AgoraLib.STATUS], params[AgoraLib.STATUSCODE]);
that.createEntitlementCallback(response4);
}
}
}
}
}
catch(e) {
console.log("AgoraLibError: " + e);
}
}
};
this.checkVersion = function() {
console.log("Checking version...");
var request = "<Request name=\"" + AgoraLib.GET_VERSION + "\" callerID=\"" + that.callerID + "\"><Parameters>";
request += "</Parameters></Request>";
var sub_payload = String.format(AgoraLib.MESSAGE_REQUEST_TEMPLATE, request);
var GetVersionVulcanMessage = new VulcanMessage(AgoraLib.MESSAGE_TYPE);
GetVersionVulcanMessage.setPayload(sub_payload);
VulcanInterface.addMessageListener(AgoraLib.RESPONSE_TYPE, that.responseCallback);
VulcanInterface.dispatchMessage(GetVersionVulcanMessage);
return;
};
this.continueWithCheckVersion = function() {
if (!that.exchangeVersion) {
that.checkVersion();
} else {
var responseObject = new AgoraLibResponse(this.exchangeVersion, AgoraLib.status.success.status, AgoraLib.status.success.code);
that.getVersionCallback(responseObject);
}
};
this.checkConnection = function(callback, ignoreACCC) {
that.getVersionCallback = callback;
var param = "";
var status = AgoraLib.status.internalClientError.status;
var statusCode = AgoraLib.status.internalClientError.code;
// CoreSync and Thor will include vulcan specifiers so we can
// use the vulcan control library to detect CoreSync and Thor and launch when not running.
var isInstalled = VulcanInterface.isAppInstalled("coresync");
if (!isInstalled) {
console.log("CoreSync does not exist");
status = AgoraLib.status.creativeCloudNotFoundError.status;
statusCode = AgoraLib.status.creativeCloudNotFoundError.code;
} else {
var isRunning = VulcanInterface.isAppRunning("coresync");
console.log("CoreSync running? : " + isRunning + ", should it be launched if not running? " + (ignoreACCC ? "no" : "yes"));
if (!isRunning && !ignoreACCC) {
// attempt to launch ACC desktop which will launch CoreSync
isRunning = VulcanInterface.launchApp("creativecloud", false, "");
if (isRunning) {
console.log("ACCC is now being launched");
var startedUpCallback = function(message) {
console.log("ACCC started up");
VulcanInterface.removeMessageListener(AgoraLib.ACCC_STARTED_UP_MESSAGE, this);
that.continueWithCheckVersion();
};
// add event listener for vulcan.SuiteMessage.any.cosy.app.StartedUp so we know CoreSync is launched and ready to receive messages
VulcanInterface.addMessageListener(AgoraLib.ACCC_STARTED_UP_MESSAGE, startedUpCallback);
return;
} else {
status = AgoraLib.status.creativeCloudFailedToLaunchError.status;
statusCode = AgoraLib.status.creativeCloudFailedToLaunchError.code;
}
} else if (!isRunning && ignoreACCC) {
// CoreSync is not running but user wants to bypass launching it. Return error to callback.
status = AgoraLib.status.creativeCloudNotLaunchedError.status;
statusCode = AgoraLib.status.creativeCloudNotLaunchedError.code;
} else {
that.continueWithCheckVersion();
return;
}
}
var responseObject = new AgoraLibResponse(param, status, statusCode);
callback(responseObject);
};
// source: http://stackoverflow.com/questions/7717109/how-can-i-compare-arbitrary-version-numbers
this.compareVersion = function (a, b) {
var i, cmp, len, re = /(\.0)+[^\.]*$/;
a = (a + '').replace(re, '').split('.');
b = (b + '').replace(re, '').split('.');
len = Math.min(a.length, b.length);
for( i = 0; i < len; i++ ) {
cmp = parseInt(a[i], 10) - parseInt(b[i], 10);
if ( cmp !== 0 ) {
return cmp;
}
}
return a.length - b.length;
};
}
//--------------------------------------- Public API ------------------------------
AgoraLib.prototype = (function(){
/**
* Triggers a check to determine if the current user is entitled to access the active extension.
* Possible responses are True, False or Unknown. Further information about the response can be found in
* the responses status and statusCode properties. For example, if the response is true, status and statusCode can
* return the following combinations:\n
* <ul>\n
* <li>1: Perpetual purchase</li>\n
* <li>2: Trial purchase</li>\n
* <li>3: Subscription purchase</li>\n
* <li>4: Subscription expired {date}</li>\n
* </ul>\n
*
* This API has a dependency on VulcanInterface.js and will throw an error if it is not defined.
*
* @param callback The JavaScript handler function to return the AgoraLibResponse object.
* @param ignoreACCC When true this API will not attempt to launch the Adobe Creative Cloud Connection application if it is not running. The default value is false.
* @since 5.2.0
*/
var isEntitled = function(callback, ignoreACCC) {
if (typeof(Vulcan) === 'undefined') {
throw 'Vulcan.js is required.';
}
if (callback === null || callback === undefined) {
callback = function(result){};
}
if (ignoreACCC === null || ignoreACCC === undefined) {
ignoreACCC = false;
}
this.isEntitledCallback = callback;
var that = this;
var success = false;
// check connection
this.checkConnection(function(responseObj) {
console.log("isEntitled checkConnection response: " + responseObj.response + " with status: " + responseObj.status + " and statusCode: " + responseObj.statusCode);
success = true;
// check status and statusCode for success.
if (responseObj.statusCode === "0" && that.compareVersion(responseObj.response, "1.0.0") >= 0) {
console.log("isEntitled: connection check successful, now continue with isEntitled API call...");
var request = "<Request name=\"" + AgoraLib.IS_ENTITLED + "\" callerID=\"" + that.callerID + "\"><Parameters>";
request += "<Parameter name=\"BundleID\"><Value>" + that.bundleID + "</Value></Parameter>";
request += "</Parameters></Request>";
var sub_payload = String.format(AgoraLib.MESSAGE_REQUEST_TEMPLATE, request);
var isEntitledVulcanMessage = new VulcanMessage(AgoraLib.MESSAGE_TYPE);
isEntitledVulcanMessage.setPayload(sub_payload);
VulcanInterface.addMessageListener(AgoraLib.RESPONSE_TYPE, that.responseCallback);
VulcanInterface.dispatchMessage(isEntitledVulcanMessage);
} else {
var response = new AgoraLibResponse("Unknown", responseObj.status, responseObj.statusCode);
callback(response);
}
}, ignoreACCC);
// add a timeout and return error if response is not returned after a minute
setTimeout(function(){
if (!success) {
console.log("isEntitled: Request timed out");
var response = new AgoraLibResponse("Unknown", AgoraLib.status.internalClientError.status, AgoraLib.status.internalClientError.code);
callback(response);
}
}, AgoraLib.TIMEOUT);
};
/**
* Calls the Adobe Exchange service for a Purchase Url for the active extension. If the request is successful the statusCode in the response will be 0.
*
* This API has a dependency on VulcanInterface.js and will throw an error if it is not defined.
*
* @param callback The JavaScript handler function to return the AgoraLibResponse object. The Response property will either be the final checkout page or the product details page (see below).
* @param straightToCheckout If set to true the URL returned will be the final checkout page for this Extension on the Adobe Add-ons site. If set to false the
* URL returned will be the Product details page for this Extension on the Adobe Add-ons site. Default is false.
* @param ignoreACCC When true this API will not attempt to launch the Adobe Creative Cloud Connection application if it is not running. The default value is false.
* @since 5.2.0
*/
var getPurchaseUrl = function(callback, straightToCheckout, ignoreACCC) {
if (typeof(Vulcan) === 'undefined') {
throw 'Vulcan.js is required.';
}
if (callback === null || callback === undefined) {
callback = function(result){};
}
if (ignoreACCC === null || ignoreACCC === undefined) {
ignoreACCC = false;
}
this.getPurchaseUrlCallback = callback;
straightToCheckout = (!requiredParamsValid(straightToCheckout) || straightToCheckout === '') ? false : straightToCheckout;
var that = this;
var success = false;
// check connection
this.checkConnection(function(responseObj) {
success = true;
console.log("getPurchaseUrl: checkConnection response: " + responseObj.response + " with status: " + responseObj.status + " and statusCode: " + responseObj.statusCode);
if (responseObj.statusCode === "0" && that.compareVersion(responseObj.response, "1.0.0") >= 0) {
console.log("Connection check successful, now continue with getPurchaseUrl API call...");
var request = "<Request name=\"" + AgoraLib.GET_PURCHASE_URL + "\" callerID=\"" + that.callerID + "\"><Parameters>";
request += "<Parameter name=\"BundleID\"><Value>" + that.bundleID + "</Value></Parameter>";
request += "<Parameter name=\"StraightToCheckout\"><Value>" + straightToCheckout + "</Value></Parameter>";
request += "</Parameters></Request>";
var sub_payload = String.format(AgoraLib.MESSAGE_REQUEST_TEMPLATE, request);
var getPurchaseUrlVulcanMessage = new VulcanMessage(AgoraLib.MESSAGE_TYPE);
getPurchaseUrlVulcanMessage.setPayload(sub_payload);
VulcanInterface.addMessageListener(AgoraLib.RESPONSE_TYPE, that.responseCallback);
VulcanInterface.dispatchMessage(getPurchaseUrlVulcanMessage);
} else {
var response = new AgoraLibResponse("", responseObj.status, responseObj.statusCode);
callback(response);
}
}, ignoreACCC);
// add a timeout and return error if response is not returned after a minute
setTimeout(function(){
if (!success) {
console.log("getPurchaseUrl: Request timed out");
var response = new AgoraLibResponse("", AgoraLib.status.internalClientError.status, AgoraLib.status.internalClientError.code);
callback(response);
}
}, AgoraLib.TIMEOUT);
};
/**
* Creates an entitlement for this extension on Adobe Exchange for the signed in user.
* If no user is available then the statusCode in the response will be 1004.
* If the request is successful the statusCode in the response will be 0.
*
* By adding an entitlement the user will be kept up date with the latest version of the extension
* which will be published to Adobe Exchange.
*
* This API has a dependency on VulcanInterface.js & CSInterface.js and will throw an error if either is not defined.
*
* @param callback The JavaScript handler function to return the AgoraLibResponse object.
* @param ignoreACCC When true this API will not attempt to launch the Adobe Creative Cloud Connection application if it is not running. The default value is false.
* @since 5.2.0
*/
var createEntitlement = function(callback, ignoreACCC) {
if (typeof(Vulcan) === 'undefined') {
throw 'Vulcan.js is required.';
}
if (typeof(CSInterface) === 'undefined') {
throw 'CSInterface.js is required.';
}
if (callback === null || callback === undefined) {
callback = function(result){};
}
if (ignoreACCC === null || ignoreACCC === undefined) {
ignoreACCC = false;
}
this.createEntitlementCallback = callback;
var that = this;
var success = false;
// check connection
this.checkConnection(function(responseObj) {
console.log("createEntitlement: checkConnection response: " + responseObj.response + " with status: " + responseObj.status + " and statusCode: " + responseObj.statusCode);
success = true;
// check status and statusCode for success.
if (responseObj.statusCode === "0" && that.compareVersion(responseObj.response, "1.0.0") >= 0) {
console.log("createEntitlement: Connection check successful, now continue with createEntitlement API call...");
var csLibrary = new CSInterface();
var extensionDir = csLibrary.getSystemPath(SystemPath.EXTENSION);
var os = csLibrary.getOSInformation();
var pathSeparator = os.indexOf("Win") >= 0 ? "\\" : "/";
var manifestPath = extensionDir + pathSeparator + "CSXS" + pathSeparator + "manifest.xml";
var fileContents = window.cep.fs.readFile(manifestPath);
var error = true;
if (window.DOMParser) {
var parser = new window.DOMParser();
try {
var xmlDoc = parser.parseFromString(fileContents.data, "text/xml");
var extManifest = xmlDoc.getElementsByTagName("ExtensionManifest")[0];
if (extManifest) {
var extensionBundleVersion = extManifest.attributes.getNamedItem("ExtensionBundleVersion").nodeValue;
var request = "<Request name=\"" + AgoraLib.CREATE_ENTITLEMENT + "\" callerID=\"" + that.callerID + "\"><Parameters>";
request += "<Parameter name=\"BundleID\"><Value>" + that.bundleID + "</Value></Parameter>";
request += "<Parameter name=\"ExtensionBundleVersion\"><Value>" + extensionBundleVersion + "</Value></Parameter>";
request += "</Parameters></Request>";
var sub_payload = String.format(AgoraLib.MESSAGE_REQUEST_TEMPLATE, request);
var createEntitlementVulcanMessage = new VulcanMessage(AgoraLib.MESSAGE_TYPE);
createEntitlementVulcanMessage.setPayload(sub_payload);
VulcanInterface.addMessageListener(AgoraLib.RESPONSE_TYPE, that.responseCallback);
VulcanInterface.dispatchMessage(createEntitlementVulcanMessage);
error = false;
}
}
catch(e) {
console.log("AgoraLibError: " + e);
}
}
if (error)
{
var response1 = new AgoraLibResponse("", AgoraLib.status.internalClientError.status, AgoraLib.status.internalClientError.code);
callback(response1);
}
} else {
var response2 = new AgoraLibResponse("", responseObj.status, responseObj.statusCode);
callback(response2);
}
}, ignoreACCC);
// add a timeout and return error if response is not returned after a minute
setTimeout(function(){
if (!success) {
console.log("createEntitlement: Request timed out");
var response = new AgoraLibResponse("", AgoraLib.status.internalClientError.status, AgoraLib.status.internalClientError.code);
callback(response);
}
}, AgoraLib.TIMEOUT);
};
return {
constructor: AgoraLib,
isEntitled: isEntitled,
getPurchaseUrl: getPurchaseUrl,
createEntitlement: createEntitlement
};
})();
/**
* Provides consts for some of the status responses returned by the AgoraLib client.
*/
AgoraLib.status = {
/* Success Responses */
success : {
status : "Success",
code : "0"
},
// Create Entitlement success responses
updateAvailable : {
status : "Success. Update available",
code : "1"
},
entitlementAlreadyCreated : {
status : "Success. Entitlement already created",
code : "2"
},
// IsEntitled success responses
perpetualPurchase : {
status : "Perpetual purchase",
code : "1"
},
trialPurchase : {
status : "Trial purchase",
code : "2"
},
subscriptionPurchase : {
status : "Subscription purchase",
code : "3"
},
free : {
status : "Free",
code : "4"
},
/* end of Success Responses */
/* Error Responses */
// IsEntitled error responses
userNotEntitledError : {
status : "User not entitled or product not found",
code : "-1"
},
subscriptionExpiredError : {
status : "Subscription expired",
code : "-2"
},
// General error responses
networkDisabledError : {
status : "Network disabled",
code : "1001"
},
networkError : {
status : "Network error",
code : "1002"
},
productNotFoundError : {
status : "Product not found",
code : "1003"
},
UserLoggedOutError : {
status : "User logged out",
code : "1004"
},
internalClientError : {
status : "Internal client error",
code : "1005"
},
internalServerError : {
status : "Internal server error",
code : "1006"
},
creativeCloudFailedToLaunchError : {
status : "Adobe Creative Cloud Desktop failed to launch",
code : "1007"
},
creativeCloudNotFoundError : {
status : "Adobe Creative Cloud Desktop is not installed",
code : "1008"
},
ApiNotSupportedError : {
status : "API not supported",
code : "1009"
},
creativeCloudNotLaunchedError : {
status : "Creative Cloud was not launched",
code : "1010"
}
};
/**
* Returned as the response by all AgoraLib APIs.
* @param string response The main result of the API request
* @param string status Textual description that either provides information of an error or additional information about the response.
* @param int statusCode status code.
*/
function AgoraLibResponse(response, status, statusCode) {
this.response = response;
this.status = status;
this.statusCode = statusCode;
}
//--------------------------------------- AgoraLib Consts ------------------------------
//
AgoraLib.IS_ENTITLED = "IsEntitled";
AgoraLib.GET_PURCHASE_URL = "GetPurchaseUrl";
AgoraLib.CREATE_ENTITLEMENT = "CreateEntitlement";
AgoraLib.GET_VERSION = "GetVersion";
AgoraLib.STATUS = "Status";
AgoraLib.STATUSCODE = "StatusCode";
AgoraLib.MESSAGE_TYPE = "vulcan.SuiteMessage.cosy.exchangeplugin.ApiRequest";
AgoraLib.RESPONSE_TYPE = "vulcan.SuiteMessage.cosy.exchangeplugin.ApiResponse";
AgoraLib.ACCC_STARTED_UP_MESSAGE = "vulcan.SuiteMessage.any.cosy.app.StartedUp";
AgoraLib.MESSAGE_REQUEST_TEMPLATE = "<Message><Requests>{0}</Requests></Message>";
AgoraLib.MESSAGE_RESPONSE_TEMPLATE = "<Message><Responses>{0}</Responses></Message>";
AgoraLib.TIMEOUT = 60000;
</pre>
</article>
</section>
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="modal fade" id="searchResults">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Search results</h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<footer>
<span class="copyright">
DocStrap Copyright © 2012-2018 The contributors to the JSDoc3 and DocStrap projects.
CEP Resources © 2013 Adobe Systems Incorporated.
</span>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Thu Apr 12th 2018
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
</footer>
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/toc.js"></script>
<script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
<script>
$( function () {
$( "[id*='$']" ).each( function () {
var $this = $( this );
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
} );
$( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () {
var $this = $( this );
var example = $this.find( "code" );
exampleText = example.html();
var lang = /{@lang (.*?)}/.exec( exampleText );
if ( lang && lang[1] ) {
exampleText = exampleText.replace( lang[0], "" );
example.html( exampleText );
lang = lang[1];
} else {
var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
lang = langClassMatch ? langClassMatch[1] : "javascript";
}
if ( lang ) {
$this
.addClass( "sunlight-highlight-" + lang )
.addClass( "linenums" )
.html( example.html() );
}
} );
Sunlight.highlightAll( {
lineNumbers : true,
showMenu : true,
enableDoclinks : true
} );
$.catchAnchorLinks( {
navbarOffset: 10
} );
$( "#toc" ).toc( {
anchorName : function ( i, heading, prefix ) {
return $( heading ).attr( "id" ) || ( prefix + i );
},
selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
showAndHide : false,
smoothScrolling: true
} );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
$( '.dropdown-toggle' ).dropdown();
$( "table" ).each( function () {
var $this = $( this );
$this.addClass('table');
} );
} );
</script>
<!--Navigation and Symbol Display-->
<!--Google Analytics-->
<script type="text/javascript">
$(document).ready(function() {
SearcherDisplay.init();
});
</script>
</body>
</html>