pixflow-upgrade-planning 0.0.32 → 0.0.33

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,6 +1,9 @@
1
1
  const parse = new DOMParser();
2
2
  const fs = require("fs");
3
3
  const path = require("path");
4
+ const CepManifest = require("pixflow-cep-manifest");
5
+ const cep_manifest = new CepManifest();
6
+ const token = require("pixflow-token");
4
7
 
5
8
  class PixflowUpgradePlanning extends HTMLElement {
6
9
 
@@ -21,14 +24,44 @@ class PixflowUpgradePlanning extends HTMLElement {
21
24
 
22
25
  if(this.port == "pixflow"){
23
26
  this.appendChild(this.template.querySelector("div.purchase-code"));
27
+ this.get_product_price_detail();
24
28
  this.querySelector("div.purchase-code > img.close").addEventListener("click", function(){
25
29
  this.parentNode.classList.remove("active");
26
30
  })
27
31
  this.querySelector("div.activate-code").addEventListener("click", this.activate_code_click);
32
+ this.querySelector("div.pixflow div.activate-code-block button").addEventListener("click", function(){
33
+ window.cep.util.openURLInDefaultBrowser(`https://pixflow.net/product/${cep_manifest.get_link()}`);
34
+ })
28
35
  }
29
36
 
30
37
  }
31
38
 
39
+ get_product_price_detail(){
40
+ const self = this;
41
+ const xhr = new XMLHttpRequest();
42
+ xhr.open("GET", `https://pixflow.net/wp-json/pixflow/get_product_price_detail?product-id=${cep_manifest.get_post_id()}&token=${token()}`);
43
+ xhr.addEventListener("load", function(){
44
+ const json = JSON.parse(this.responseText);
45
+ self.querySelectorAll("img.loading").forEach(function(element){
46
+ element.remove();
47
+ })
48
+ var off = parseInt(json.off_percentage);
49
+ var single = parseInt(json.single.price);
50
+ var team = parseInt(json.team.price);
51
+ var strSingle = `$${single}`;
52
+ var strTeam = `$${team}`;
53
+ if(off > 0){
54
+ single = Math.floor((100 - off) / 100 * parseInt(json.single.price));
55
+ team = Math.floor((100 - off) / 100 * parseInt(json.team.price));
56
+ strSingle = `$${single} <del>$${json.single.price}</del>`;
57
+ strTeam = `$${team} <del>$${json.team.price}</del>`;
58
+ }
59
+ self.querySelector("div.pixflow > div.plan > div.single > div > div:nth-child(2)").innerHTML = strSingle;
60
+ self.querySelector("div.pixflow > div.plan > div.team > div > div:nth-child(2)").innerHTML = strTeam;
61
+ })
62
+ xhr.send(null);
63
+ }
64
+
32
65
  activate_code_click(e){
33
66
  e.target.parentNode.parentNode.parentNode.querySelector("div.purchase-code").classList.add("active");
34
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixflow-upgrade-planning",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -8,5 +8,9 @@
8
8
  },
9
9
  "keywords": [],
10
10
  "author": "",
11
- "license": "ISC"
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "pixflow-token": "^1.0.0",
14
+ "pixflow-cep-manifest": "^1.0.0"
15
+ }
12
16
  }
@@ -129,6 +129,7 @@ pixflow-upgrade-planning > div.pixflow button, pixflow-upgrade-planning > div.pu
129
129
  color: #fff;
130
130
  transition: filter 200ms;
131
131
  border: 0;
132
+ outline: 0;
132
133
  }
133
134
 
134
135
  pixflow-upgrade-planning > div.pixflow > div:nth-child(5) {
@@ -192,10 +193,6 @@ pixflow-upgrade-planning > div.pixflow div.activate-code {
192
193
  margin: 15px 0;
193
194
  }
194
195
 
195
- a, .btn, button, ul > li > div, ul > li > img, ul > li > div.arrow.right, pixflow-upgrade-planning > div.pixflow > div.plan > div, #activate, #dashboard > div, #dashboard img, .apply, .unlock, #customize > div.params > div.header > div, pixflow-upgrade-planning > div.pixflow > div.activate-code, .view-details, body > div.right-side > div.header > div.views > img.view-small-icon {
196
- cursor: pointer;
197
- }
198
-
199
196
  pixflow-upgrade-planning > div.pixflow div.activate-code {
200
197
  color: #7C879A;
201
198
  font-size: 13px;