iobroker.parcel 0.1.0 → 0.1.2

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.
Files changed (3) hide show
  1. package/io-package.json +9 -1
  2. package/main.js +42 -28
  3. package/package.json +8 -8
package/io-package.json CHANGED
@@ -1,8 +1,16 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "parcel",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "news": {
6
+ "0.1.2": {
7
+ "en": "Fix Amazon Status",
8
+ "de": "Amazon Status gefixt"
9
+ },
10
+ "0.1.1": {
11
+ "en": "Fix State creating warnings",
12
+ "de": "Warnung beim erstellen von Objekten behoben"
13
+ },
6
14
  "0.1.0": {
7
15
  "en": "Fix Hermes login"
8
16
  },
package/main.js CHANGED
@@ -1628,6 +1628,7 @@ class Parcel extends utils.Adapter {
1628
1628
  this.json2iob.parse(element.path, data, {
1629
1629
  forceIndex: forceIndex,
1630
1630
  preferedArrayName: preferedArrayName,
1631
+ dontSaveCreatedObjects: true,
1631
1632
  });
1632
1633
  data && this.setState(element.path + ".json", JSON.stringify(data), true);
1633
1634
  }
@@ -1670,18 +1671,18 @@ class Parcel extends utils.Adapter {
1670
1671
  }
1671
1672
  async cleanupProvider(id, data) {
1672
1673
  if (id === "dhl" && data.hasOwnProperty("grantToken")) {
1673
- await this.delObjectAsync("dhl.briefe", { recursive: true });
1674
- await this.setObjectNotExistsAsync("dhl.briefe.json", {
1675
- type: "state",
1676
- common: {
1677
- name: "Json Briefe",
1678
- write: false,
1679
- read: true,
1680
- type: "string",
1681
- role: "json",
1682
- },
1683
- native: {},
1684
- });
1674
+ // await this.delObjectAsync("dhl.briefe", { recursive: true });
1675
+ // await this.setObjectNotExistsAsync("dhl.briefe.json", {
1676
+ // type: "state",
1677
+ // common: {
1678
+ // name: "Json Briefe",
1679
+ // write: false,
1680
+ // read: true,
1681
+ // type: "string",
1682
+ // role: "json",
1683
+ // },
1684
+ // native: {},
1685
+ // });
1685
1686
  }
1686
1687
  if ((id === "dhl" || id === "dpd" || id === "amz" || id === "gls" || id === "ups" || id === "hermes") && data && data.sendungen) {
1687
1688
  const states = await this.getStatesAsync(id + ".sendungen*.id");
@@ -2142,13 +2143,31 @@ class Parcel extends utils.Adapter {
2142
2143
  const dom = new JSDOM(res.data);
2143
2144
  const document = dom.window.document;
2144
2145
  const statusHandle =
2145
- document.querySelector(".milestone-primaryMessage.alpha") || document.querySelector(".milestone-primaryMessage") || null;
2146
- const additionalStatus = document.querySelector("#primaryStatus")
2146
+ document.querySelector(".pt-status-main-status") ||
2147
+ document.querySelector(".milestone-primaryMessage.alpha") ||
2148
+ document.querySelector(".milestone-primaryMessage") ||
2149
+ null;
2150
+ let additionalStatus = document.querySelector("#primaryStatus")
2147
2151
  ? document.querySelector("#primaryStatus").textContent.replace(/\n */g, "")
2148
2152
  : "";
2149
- const secondaryStatus = document.querySelector("#secondaryStatus")
2153
+ let secondaryStatus = document.querySelector("#secondaryStatus")
2150
2154
  ? document.querySelector("#secondaryStatus").textContent.replace(/\n */g, "")
2151
2155
  : "";
2156
+ if (!secondaryStatus) {
2157
+ secondaryStatus = document.querySelector(".pt-promise-details-slot")
2158
+ ? document.querySelector(".pt-promise-details-slot").textContent.replace(/\n */g, "")
2159
+ : "";
2160
+ }
2161
+ if (!secondaryStatus) {
2162
+ secondaryStatus = document.querySelector(".pt-status-secondary-status")
2163
+ ? document.querySelector(".pt-status-secondary-status").textContent.replace(/\n */g, "")
2164
+ : "";
2165
+ }
2166
+ if (!additionalStatus) {
2167
+ additionalStatus = document.querySelector(".pt-promise-main-slot")
2168
+ ? document.querySelector(".pt-promise-main-slot").textContent.replace(/\n */g, "")
2169
+ : "";
2170
+ }
2152
2171
  let stopsStatus = "";
2153
2172
  let stateObject = {};
2154
2173
  if (document.querySelector(`script[data-a-state='{"key":"page-state"}']`)) {
@@ -2164,6 +2183,12 @@ class Parcel extends utils.Adapter {
2164
2183
  }
2165
2184
 
2166
2185
  let status = statusHandle ? statusHandle.textContent.replace(/\n */g, "") : "";
2186
+ if (!status) {
2187
+ status = stateObject.promise?.promiseMessage;
2188
+ }
2189
+ if (!additionalStatus) {
2190
+ additionalStatus = stateObject.promise?.pdwHelpIconMessage;
2191
+ }
2167
2192
  if (!status) {
2168
2193
  status = additionalStatus;
2169
2194
  }
@@ -2180,8 +2205,8 @@ class Parcel extends utils.Adapter {
2180
2205
  }
2181
2206
 
2182
2207
  return {
2183
- id: document.querySelector(".carrierRelatedInfo-trackingId-text")
2184
- ? document.querySelector(".carrierRelatedInfo-trackingId-text").textContent.replace("Trackingnummer ", "")
2208
+ id: document.querySelector(".pt-delivery-card-trackingId")
2209
+ ? document.querySelector(".pt-delivery-card-trackingId").textContent.replace("Trackingnummer ", "")
2185
2210
  : "",
2186
2211
  name: document.querySelector(".carrierRelatedInfo-mfn-providerTitle")
2187
2212
  ? document.querySelector(".carrierRelatedInfo-mfn-providerTitle").textContent.replace(/\\n */g, "")
@@ -2374,17 +2399,6 @@ class Parcel extends utils.Adapter {
2374
2399
  },
2375
2400
  native: {},
2376
2401
  });
2377
- await this.setObjectNotExistsAsync("dhl.json", {
2378
- type: "state",
2379
- common: {
2380
- name: "Json Sendungen",
2381
- write: false,
2382
- read: true,
2383
- type: "string",
2384
- role: "json",
2385
- },
2386
- native: {},
2387
- });
2388
2402
 
2389
2403
  await this.setObjectNotExistsAsync("dhl.json", {
2390
2404
  type: "state",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.parcel",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Parcel tracking",
5
5
  "author": {
6
6
  "name": "TA2k",
@@ -25,11 +25,11 @@
25
25
  "url": "https://github.com/TA2k/ioBroker.parcel"
26
26
  },
27
27
  "dependencies": {
28
- "@iobroker/adapter-core": "^2.6.8",
29
- "axios": "^1.4.0",
28
+ "@iobroker/adapter-core": "^3.0.3",
29
+ "axios": "^1.5.0",
30
30
  "http-cookie-agent": "^5.0.4",
31
31
  "jsdom": "^21.1.2",
32
- "json2iob": "^2.4.5",
32
+ "json2iob": "^2.4.6",
33
33
  "qs": "^6.11.2",
34
34
  "tough-cookie": "^4.1.3",
35
35
  "uuid": "^9.0.0"
@@ -39,18 +39,18 @@
39
39
  "@types/chai": "^4.3.5",
40
40
  "@types/chai-as-promised": "^7.1.5",
41
41
  "@types/mocha": "^10.0.1",
42
- "@types/node": "^20.4.10",
42
+ "@types/node": "^20.5.7",
43
43
  "@types/proxyquire": "^1.3.28",
44
44
  "@types/sinon": "^10.0.16",
45
45
  "@types/sinon-chai": "^3.2.9",
46
- "chai": "^4.3.7",
46
+ "chai": "^4.3.8",
47
47
  "chai-as-promised": "^7.1.1",
48
- "eslint": "^8.47.0",
48
+ "eslint": "^8.48.0",
49
49
  "mocha": "^10.2.0",
50
50
  "proxyquire": "^2.1.3",
51
51
  "sinon": "^15.2.0",
52
52
  "sinon-chai": "^3.7.0",
53
- "typescript": "~5.1.6"
53
+ "typescript": "~5.2.2"
54
54
  },
55
55
  "main": "main.js",
56
56
  "files": [