@widgetic/editor 3.10.40 → 3.10.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/editor",
3
- "version": "3.10.40",
3
+ "version": "3.10.42",
4
4
  "scripts": {
5
5
  "start": "webpack --config webpack.config.js --watch --progress",
6
6
  "build": "webpack --config webpack.config.js",
@@ -51,12 +51,19 @@ class InstagramBrowser extends Controller
51
51
  # use the first one as the connected account
52
52
  # (there should be only one, but just in case)
53
53
  @authenticated = !!@content.length
54
+ console.log("Editor Instagram Browser @authenticated:", @authenticated, @content[0]);
54
55
  @el.attr {@authenticated}
55
56
  if @authenticated
56
57
  @connectedAccount = @content[0]
57
58
  # the content metadata stores the SHA256 hash of the user's Instagram token
58
59
  @service.getUser(@connectedAccount.token)
59
- .then((user) => this._updateLogoutIntent(user))
60
+ .then((user) =>
61
+ if(user.error)
62
+ # console.log("editor browser get inst user:", user.error)
63
+ @onAuth(false);
64
+ else
65
+ this._updateLogoutIntent(user)
66
+ )
60
67
 
61
68
  active: ->
62
69
  Activateable.active.apply @, arguments
@@ -74,7 +81,7 @@ class InstagramBrowser extends Controller
74
81
  true
75
82
 
76
83
  onAuth: (@authenticated) =>
77
- # console.log("Editor browser onAuth:", @authenticated)
84
+ console.log("Editor browser onAuth:", @authenticated)
78
85
  @el.attr {@authenticated}
79
86
  @$trigger "editor:browser:auth", service: @Service.name, @authenticated
80
87
  return unless @authenticated
@@ -109,6 +116,7 @@ class InstagramBrowser extends Controller
109
116
  @tab.count @content.length
110
117
 
111
118
  _updateLogoutIntent: (user) ->
119
+ console.log("update logout intent:", user)
112
120
  @logoutIntent.remove()
113
121
  @logoutIntent = $ LogoutIntent user
114
122
  @el.append @logoutIntent
@@ -1,7 +1,7 @@
1
1
  Service = require '../../../browser/model'
2
2
 
3
3
  # Instagram service config
4
- host = 'https://widgetic.com' + '/wservices/instagram'
4
+ host = 'https://widgetic.com' + '/services/instagram' #live server path
5
5
  INSTAGRAM_DEFAULTS = {
6
6
  client_id: '542808610040105', #widgetic instagram basic display app id
7
7
  client_secret: '0a88504381f577dbbef400d4232a4258',
@@ -18,9 +18,15 @@ INSTAGRAM_DEFAULTS = {
18
18
  }
19
19
  api = window.INSTAGRAM_SERVICE_CONFIG || INSTAGRAM_DEFAULTS
20
20
  # console.log("EDITOR Instagram API:", api);
21
+
22
+ # read current logged user's instagram auth token
21
23
  try api.token = localStorage.getItem 'instagramAuthToken'
24
+ console.log("EDITOR Instagram Service current user's token:", api.token);
25
+
26
+ # define auth url that will open in authorize popup
22
27
  auth_url = "https://api.instagram.com/oauth/authorize/?client_id=#{api.client_id}&redirect_uri=#{api.redirect_uri}&response_type=#{api.response_type}&scope=#{api.scope}"
23
28
 
29
+ # INSTAGRAM SERVICE CLASS
24
30
  class InstagramService extends Service
25
31
  @browser: 'browser/controller/instagram'
26
32
 
@@ -33,7 +39,8 @@ class InstagramService extends Service
33
39
  return api.token
34
40
 
35
41
  getUser: (token) ->
36
- url = "#{api.api_url}me"
42
+ console.log("Editor Instagram Service getUser:", token, api.api_url);
43
+ url = "#{api.api_url}/me"
37
44
  $.ajax(url: url, type: 'GET', dataType: 'json', headers: {'X-Token': token})
38
45
 
39
46
  _auth: (interactive=true) ->
@@ -42,11 +49,11 @@ class InstagramService extends Service
42
49
  if api.token?
43
50
  @getUser(api.token)
44
51
  .then (result) =>
45
- # console.log("Editor getUser result:", result)
52
+ console.log("Editor get User result:", result)
46
53
  @user = result
47
54
  @trigger 'auth', @authenticated = true
48
55
  .catch =>
49
- # console.log("Editor getUser error:", error)
56
+ console.log("Editor get User error:", error)
50
57
  @deauth()
51
58
  # console.log("Editor INSTG service _auth method:", interactive, api);
52
59
  # if not authenticated open popup
@@ -2,7 +2,7 @@ Service = require '../../../browser/model'
2
2
  Entry = require '../../../browser/model/entry'
3
3
 
4
4
  # Instagram service config
5
- host = 'https://widgetic.com' + '/wservices/instagram/'
5
+ host = 'https://widgetic.com' + '/services/instagram/'
6
6
  INSTAGRAM_DEFAULTS = {
7
7
  client_id: '542808610040105', #widgetic instagram basic display app id
8
8
  client_secret: '0a88504381f577dbbef400d4232a4258',