pixflow-upgrade-planning 0.0.35 → 0.0.37

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
@@ -4,6 +4,8 @@ const path = require("path");
4
4
  const CepManifest = require("pixflow-cep-manifest");
5
5
  const cep_manifest = new CepManifest();
6
6
  const token = require("pixflow-token");
7
+ const PixflowPurchaseCodeActivate = require("pixflow-purchase-code-activate");
8
+ const purchase_code = new PixflowPurchaseCodeActivate();
7
9
 
8
10
  class PixflowUpgradePlanning extends HTMLElement {
9
11
 
@@ -21,6 +23,8 @@ class PixflowUpgradePlanning extends HTMLElement {
21
23
  this.template = parse.parseFromString(fs.readFileSync(path.join(__dirname, "template.html")).toString("utf8"), "text/html");
22
24
  this.appendChild(this.template.querySelector(`div.${this.port}`));
23
25
 
26
+ purchase_code.check_device_select();
27
+
24
28
  this.querySelector(`img.close`).addEventListener("click", this.close_click);
25
29
 
26
30
  if(this.port == "pixflow"){
@@ -47,6 +51,22 @@ class PixflowUpgradePlanning extends HTMLElement {
47
51
  this.classList.add("active");
48
52
  })
49
53
  })
54
+
55
+ this.querySelector("div.purchase-code > form > button").addEventListener("click", async function(e){
56
+ e.preventDefault();
57
+ purchase_code.set_code(self.querySelector("div.purchase-code > form > input[type=text]").value);
58
+ const message = self.querySelector("div.purchase-code > form > p.message");
59
+ const msg = self.querySelectorAll("div.purchase-code > form > ul.msg > *");
60
+ const res = await purchase_code.activate_code();
61
+ if(!res.error){
62
+ message.innerHTML = msg[0].innerHTML;
63
+ setTimeout(function(){
64
+ window.location.href = cep_manifest.get_main_path();
65
+ }, 1500);
66
+ } else {
67
+ message.innerHTML = msg[1].innerHTML;
68
+ }
69
+ })
50
70
  }
51
71
 
52
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixflow-upgrade-planning",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -384,4 +384,8 @@ pixflow-upgrade-planning div.purchase-code > p.buy > a {
384
384
 
385
385
  pixflow-upgrade-planning div.purchase-code div.result {
386
386
  color: #FFFFFF;
387
- }
387
+ }
388
+
389
+ pixflow-upgrade-planning div.purchase-code ul.msg {
390
+ display: none;
391
+ }
package/template.html CHANGED
@@ -64,6 +64,10 @@
64
64
  <input type="text" spellcheck="false" placeholder="Purchase code">
65
65
  <p class="message"></p>
66
66
  <button>ACTIVATE</button>
67
+ <ul class="msg">
68
+ <li>Activation was successful.</li>
69
+ <li>Invalid purchase code!</li>
70
+ </ul>
67
71
  <div class="back-upgrade-plan">Purchase Pro Membership</div>
68
72
  </form>
69
73
  </div>