zendesk_apps_support 4.12.1 → 4.12.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36128bad8a975fd6a4806d325ad2da64ad9d2bda
4
- data.tar.gz: ba2770fdfaa2c168aa1cebb8e2627f7285806616
3
+ metadata.gz: 9dd1ae30c3fa86d421b5eb617f21379dd75eac3d
4
+ data.tar.gz: a46ee2adb8b00121f0fe94c7b5a93d38c393dfbe
5
5
  SHA512:
6
- metadata.gz: '08fde5da17ecbc0a46f5507c3521beadee4152610b46ee88dba6642d150afce21acf59240ab84d76051110c863bf39b0675dfe95be1e1af800f662ba9b54d4cd'
7
- data.tar.gz: 83e88e22a505e175fdb99b602e7d7c4acb89340f3525456221d34bc2a4b5644f8ac20f6f6bf11715b974bf2b5aeaf8951d54f028526b24c21001cd3516188df2
6
+ metadata.gz: 006bad071aa45ddcb2bb9f7cfcfeb554b3cb059daa7f09f1735097f788fb0190186f1aa861c9def4e5f7b905685e4377525f4394095fc22e90757d5290cc67a9
7
+ data.tar.gz: 3d91c4c79009d9b9bbcd384ee1b4a891ac364b7dfba034d7e946acb2835c8b22b098b00b02f0df2f2d37026d2b2ad5f66b1306de0ec9174b5d1ca6e2ba1dad3d
@@ -1,33 +1,48 @@
1
1
  (function() {
2
- var self = this;
3
- var reporter = window.ZendeskReporter ? new window.ZendeskReporter() : {};
4
-
5
- // This is just defining a wrapped version of jQuery which simply makes a
6
- // pass through call to global window.jQuery and adds logging information
7
- // about the origin of the page to Datadog.
8
- function wrapped$() {
9
- reporter.increment && reporter.increment(
10
- 'app_framework.app_scope.violated',
11
- 1,
12
- ['origin:' + self.location.hostname]
13
- );
14
- return self.$.apply(null, arguments);
15
- }
16
-
17
- // Adding the wrapped version of jQeury to a clone of window object, which
18
- // will be used to bind the app's scope.
19
- var wrappedWindow = this.$.extend(true, {}, self, { $: wrapped$ });
20
- wrappedWindow.window = wrappedWindow;
21
- wrappedWindow.top = wrappedWindow;
2
+ <% if apps_zaf_naughty_v1_logging %>
3
+ var self = this;
4
+ var reporter = window.ZendeskReporter ? new window.ZendeskReporter() : {};
5
+
6
+ function getWrappedWindow(appName) {
7
+ // This is just defining a wrapped version of jQuery which simply makes a
8
+ // pass through call to global window.jQuery and adds logging information
9
+ // about the origin of the page to Datadog.
10
+ function wrapped$() {
11
+ reporter.increment && reporter.increment(
12
+ 'app_framework.app_scope.violated',
13
+ 1,
14
+ ['origin:' + self.location.hostname, 'app_name:' + appName]
15
+ );
16
+
17
+ return self.$.apply(null, arguments);
18
+ }
19
+
20
+ // Adding the wrapped version of jQeury to a clone of window object, which
21
+ // will be used to bind the app's scope.
22
+ var wrappedWindow = this.$.extend({}, self, { $: wrapped$ });
23
+ wrappedWindow.window = wrappedWindow;
24
+ wrappedWindow.top = wrappedWindow;
25
+
26
+ return wrappedWindow;
27
+ }
28
+ <% end %>
22
29
 
23
30
  <% appsjs.each do |appjs| %>
24
31
  <% if apps_zaf_naughty_v1_logging %>
32
+ // Find the appName from source
33
+ var appName = "UNKNOWN";
34
+
35
+ <% appNameMatch = appjs.match(/\.reopen\(\{\s*appName\: (\"[^\n]*\"),/m) %>
36
+ <% if appNameMatch && appNameMatch.captures.any? %>
37
+ appName = <%= appNameMatch.captures[0] %>;
38
+ <% end %>
39
+
25
40
  // Trying to match a v1 apps self executing function here and bind it to the
26
41
  // wrappedWindow instance defined above.
27
42
  // }()); ==> }.bind(wrappedWindow)());
28
43
  <%= appjs.gsub(
29
44
  /}\(\)\)\;*\s*;*\s*}\s*var\s*app\s*=\s*ZendeskApps\.defineApp\(source\)/mx,
30
- "}.bind(wrappedWindow)());\n;\n}\n\nvar app = ZendeskApps.defineApp(source)"
45
+ "}.bind(getWrappedWindow(appName))());\n;\n}\n\nvar app = ZendeskApps.defineApp(source)"
31
46
  ) %>
32
47
  <% else %>
33
48
  <%= appjs %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zendesk_apps_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.12.1
4
+ version: 4.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James A. Rosen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-08-13 00:00:00.000000000 Z
14
+ date: 2018-08-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: i18n