pixflow-upgrade-planning 1.1.3 → 1.1.5

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 = parseInt(json.single.price);
103
- var team = parseInt(json.team.price);
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.3",
3
+ "version": "1.1.5",
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
  }
@@ -195,6 +195,11 @@ pixflow-upgrade-planning > div.pixflow div.activate-code {
195
195
  color: #7C879A;
196
196
  font-size: 13px;
197
197
  cursor: pointer;
198
+ display: none;
199
+ }
200
+
201
+ pixflow-upgrade-planning > div.pixflow div.activate-code.active {
202
+ display: block!important;
198
203
  }
199
204
 
200
205
  pixflow-upgrade-planning > div.pixflow > div.plan > div {
@@ -206,6 +211,7 @@ pixflow-upgrade-planning > div.pixflow > div.plan > div {
206
211
  pixflow-upgrade-planning > div.pixflow > div.plan > div > p, pixflow-upgrade-planning > div.pixflow > div.plan > div > div > div:nth-child(2) {
207
212
  color: #fff;
208
213
  font-size: 12px;
214
+ text-transform: capitalize;
209
215
  }
210
216
 
211
217
  pixflow-upgrade-planning > div.pixflow > div.container-button {
package/template.html CHANGED
@@ -3,24 +3,7 @@
3
3
  <img src="./node_modules/pixflow-upgrade-planning/images/drawer.svg" class="close">
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
- <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>
23
- </div>
6
+ <div class="plan"></div>
24
7
  <div class="activate-code-block">
25
8
  <button class="btn">Go premium <img src="./node_modules/pixflow-upgrade-planning/images/pixflow/outside-link.svg"></button>
26
9
  <div class="activate-code">Do you have the purchase code?</div>
@@ -70,4 +53,13 @@
70
53
  </ul>
71
54
  <div class="back-upgrade-plan">Purchase Pro Membership</div>
72
55
  </form>
56
+ </div>
57
+
58
+ <div class="template-plan"> <!-- plan name -->
59
+ <div class=""> <!-- active -->
60
+ <img src=""> <!-- icon -->
61
+ <div><img src="./node_modules/pixflow-upgrade-planning/images/pixflow/loading.png" class="loading"><!-- price --></div>
62
+ <div></div>
63
+ </div>
64
+ <p></p> <!-- plan name -->
73
65
  </div>