pixflow-upgrade-planning 1.1.4 → 1.1.6

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/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ require("pixflow-loader-mf");
1
2
  const parse = new DOMParser();
2
3
  const fs = require("fs");
3
4
  const path = require("path");
@@ -14,7 +15,7 @@ class PixflowUpgradePlanning extends HTMLElement {
14
15
  this.port = localStorage.getItem("port");
15
16
  }
16
17
 
17
- connectedCallback(){
18
+ async connectedCallback(){
18
19
  const self = this;
19
20
  const style = document.createElement("style");
20
21
  style.textContent = fs.readFileSync(path.join(__dirname, "styles", `${this.port}.css`));
@@ -23,7 +24,7 @@ class PixflowUpgradePlanning extends HTMLElement {
23
24
  this.template = parse.parseFromString(fs.readFileSync(path.join(__dirname, "template.html")).toString("utf8"), "text/html");
24
25
  this.appendChild(this.template.querySelector(`div.${this.port}`));
25
26
 
26
- purchase_code.check_device_select();
27
+ await purchase_code.check_device_select();
27
28
 
28
29
  this.querySelector(`img.close`).addEventListener("click", this.close_click);
29
30
 
@@ -35,22 +36,9 @@ class PixflowUpgradePlanning extends HTMLElement {
35
36
  this.parentNode.classList.remove("active");
36
37
  })
37
38
  this.querySelector("div.activate-code").addEventListener("click", this.activate_code_click);
38
- this.querySelector("div.pixflow div.activate-code-block button").addEventListener("click", function(){
39
- const license = self.querySelector("div.plan > div > div.active").parentNode.className.split(" ")[0];
40
- const link = `https://pixflow.net/product/${cep_manifest.get_link()}/?active-license=${license}`;
41
- window.cep.util.openURLInDefaultBrowser(link);
42
- })
43
39
  this.querySelector("div.purchase-code form div.back-upgrade-plan").addEventListener("click", function(){
44
40
  this.parentNode.parentNode.classList.remove("active");
45
41
  })
46
- this.querySelectorAll("div.plan > div > div").forEach(function(element){
47
- element.addEventListener("click", function(){
48
- try {
49
- self.querySelector("div.plan > div > div.active").classList.remove("active");
50
- } catch(e) {}
51
- this.classList.add("active");
52
- })
53
- })
54
42
 
55
43
  this.querySelector("div.purchase-code > form > button").addEventListener("click", async function(e){
56
44
  e.preventDefault();
@@ -70,6 +58,11 @@ class PixflowUpgradePlanning extends HTMLElement {
70
58
  })
71
59
  }
72
60
 
61
+ const device = await purchase_code.check_device_select();
62
+ if(cep_manifest.get_link_market() || !device){
63
+ this.querySelector("div.activate-code").classList.add("active");
64
+ }
65
+
73
66
  }
74
67
 
75
68
  active_next_license(){
@@ -98,21 +91,44 @@ class PixflowUpgradePlanning extends HTMLElement {
98
91
  self.querySelectorAll("img.loading").forEach(function(element){
99
92
  element.remove();
100
93
  })
101
- var off = parseInt(json.off_percentage);
102
- var single = json.single != null ? parseInt(json.single.price) : 0;
103
- var team = json.team != null ? parseInt(json.team.price) : 0;
104
- var strSingle = `$${single}`;
105
- var strTeam = `$${team}`;
106
- if(off > 0){
107
- single = Math.floor((100 - off) / 100 * parseInt(json.single.price));
108
- team = Math.floor((100 - off) / 100 * parseInt(json.team.price));
109
- strSingle = `$${single} <del>$${json.single.price}</del>`;
110
- strTeam = `$${team} <del>$${json.team.price}</del>`;
94
+ for(const plan in json){
95
+ if(plan == "free" || plan == "price_without_off")
96
+ continue;
97
+ const el_plan = self.querySelector("div.plan").appendChild(self.template.querySelector("div.template-plan").cloneNode(true));
98
+ el_plan.className = plan.toLowerCase().replace(/\s/g, "-");
99
+ var off = parseInt(json.off_percentage);
100
+ var price = json[plan] != null ? parseFloat(json[plan].price) : 0;
101
+ var url = json[plan].URL != null ? json[plan].URL : "";
102
+ var str_price = `$${price}`;
103
+ if(off > 0){
104
+ price = Math.floor((100 - off) / 100 * parseInt(json[plan].price));
105
+ str_price = `$${price} <del>$${json[plan].price}</del>`;
106
+ }
107
+ el_plan.querySelector("div > div:nth-child(2)").innerHTML = str_price;
108
+ el_plan.querySelector("div > img").src = json[plan].icon;
109
+ el_plan.setAttribute("data-url", url);
110
+ el_plan.querySelector("div > p").textContent = plan;
111
111
  }
112
- self.querySelector("div.pixflow > div.plan > div.single > div > div:nth-child(2)").innerHTML = strSingle;
113
- self.querySelector("div.pixflow > div.plan > div.team > div > div:nth-child(2)").innerHTML = strTeam;
112
+ self.querySelector("div.pixflow div.activate-code-block button").addEventListener("click", function(){
113
+ const plan = self.querySelector("div.plan > div > div.active").parentNode;
114
+ const license = plan.className.split(" ")[0];
115
+ let link;
116
+ if(license == "pixflow-full-access")
117
+ link = plan.getAttribute("data-url");
118
+ else
119
+ link = `https://pixflow.net/product/${cep_manifest.get_link()}/?active-license=${license}`;
120
+ window.cep.util.openURLInDefaultBrowser(link);
121
+ })
122
+ self.querySelectorAll("div.plan > div > div").forEach(function(element){
123
+ element.addEventListener("click", function(){
124
+ try {
125
+ self.querySelector("div.plan > div > div.active").classList.remove("active");
126
+ } catch(e) {}
127
+ this.classList.add("active");
128
+ })
129
+ })
114
130
  })
115
- xhr.send(null);
131
+ xhr.send(null);
116
132
  }
117
133
 
118
134
  activate_code_click(e){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixflow-upgrade-planning",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,8 +10,9 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "pixflow-token": "^1.0.0",
14
13
  "pixflow-cep-manifest": "^1.0.0",
15
- "pixflow-purchase-code-activate": "^1.0.0"
14
+ "pixflow-loader-mf": "^1.0.3",
15
+ "pixflow-purchase-code-activate": "^1.0.0",
16
+ "pixflow-token": "^1.0.0"
16
17
  }
17
18
  }
@@ -11,15 +11,13 @@ pixflow-upgrade-planning > div.pixflow > div.plan > div, pixflow-upgrade-plannin
11
11
  cursor: pointer;
12
12
  }
13
13
 
14
- pixflow-upgrade-planning > div.pixflow > div.plan > div > div > div:nth-child(2) > img {
14
+ pixflow-upgrade-planning > div.pixflow > div.plan > img {
15
15
  animation-name: rotate-loading;
16
16
  animation-duration: 2s;
17
17
  animation-iteration-count: infinite;
18
18
  animation-timing-function: linear;
19
- }
20
-
21
- pixflow-upgrade-planning > div.pixflow > div.plan > div > div > div:nth-child(2) > img {
22
19
  margin-top: 10px;
20
+ width: 128px;
23
21
  }
24
22
 
25
23
  pixflow-upgrade-planning > div.pixflow {
@@ -195,6 +193,11 @@ pixflow-upgrade-planning > div.pixflow div.activate-code {
195
193
  color: #7C879A;
196
194
  font-size: 13px;
197
195
  cursor: pointer;
196
+ display: none;
197
+ }
198
+
199
+ pixflow-upgrade-planning > div.pixflow div.activate-code.active {
200
+ display: block!important;
198
201
  }
199
202
 
200
203
  pixflow-upgrade-planning > div.pixflow > div.plan > div {
@@ -206,6 +209,7 @@ pixflow-upgrade-planning > div.pixflow > div.plan > div {
206
209
  pixflow-upgrade-planning > div.pixflow > div.plan > div > p, pixflow-upgrade-planning > div.pixflow > div.plan > div > div > div:nth-child(2) {
207
210
  color: #fff;
208
211
  font-size: 12px;
212
+ text-transform: capitalize;
209
213
  }
210
214
 
211
215
  pixflow-upgrade-planning > div.pixflow > div.container-button {
package/template.html CHANGED
@@ -4,22 +4,7 @@
4
4
  <img src="./node_modules/pixflow-upgrade-planning/images/pixflow/upgrade-planning-icon.svg" alt="">
5
5
  <p>Pro Membership unlocks all the features and templates and in higher tier also lets you use the plugin with your team members.</p>
6
6
  <div class="plan">
7
- <div class="single">
8
- <div class="active">
9
- <img src="./node_modules/pixflow-upgrade-planning/images/pixflow/single.png">
10
- <div><img src="./node_modules/pixflow-upgrade-planning/images/pixflow/loading.png" class="loading"></div>
11
- <div></div>
12
- </div>
13
- <p>Single</p>
14
- </div>
15
- <div class="team">
16
- <div>
17
- <img src="./node_modules/pixflow-upgrade-planning/images/team.png">
18
- <div><img src="./node_modules/pixflow-upgrade-planning/images/pixflow/loading.png" class="loading"></div>
19
- <div></div>
20
- </div>
21
- <p>5 Users</p>
22
- </div>
7
+ <img src="./node_modules/pixflow-upgrade-planning/images/pixflow/loading.png" class="loading">
23
8
  </div>
24
9
  <div class="activate-code-block">
25
10
  <button class="btn">Go premium <img src="./node_modules/pixflow-upgrade-planning/images/pixflow/outside-link.svg"></button>
@@ -70,4 +55,13 @@
70
55
  </ul>
71
56
  <div class="back-upgrade-plan">Purchase Pro Membership</div>
72
57
  </form>
58
+ </div>
59
+
60
+ <div class="template-plan"> <!-- plan name -->
61
+ <div class=""> <!-- active -->
62
+ <img src=""> <!-- icon -->
63
+ <div><!-- price --></div>
64
+ <div></div>
65
+ </div>
66
+ <p></p> <!-- plan name -->
73
67
  </div>