universal-parcel-scraper 0.178.0-main.1306 → 0.181.0

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 (49) hide show
  1. package/README.md +3 -3
  2. package/data/catalog.json +56 -4
  3. package/data/coverage-summary.json +2 -2
  4. package/data/detection-golden.json +16 -0
  5. package/dist/browser/scraper.js +49 -6
  6. package/dist/carriers/5post/adapter.d.ts +22 -0
  7. package/dist/carriers/5post/adapter.js +75 -0
  8. package/dist/carriers/5post/carrier.json +44 -7
  9. package/dist/carriers/5post/numbers.json +22 -22
  10. package/dist/carriers/5post/parser.d.ts +23 -0
  11. package/dist/carriers/5post/parser.js +164 -0
  12. package/dist/carriers/5post/status.d.ts +9 -0
  13. package/dist/carriers/5post/status.js +100 -0
  14. package/dist/carriers/5post/statuses.json +63 -3
  15. package/dist/carriers/ems-vietnam/adapter.d.ts +17 -0
  16. package/dist/carriers/ems-vietnam/adapter.js +60 -0
  17. package/dist/carriers/ems-vietnam/carrier.json +65 -7
  18. package/dist/carriers/ems-vietnam/parser.d.ts +22 -0
  19. package/dist/carriers/ems-vietnam/parser.js +216 -0
  20. package/dist/carriers/ems-vietnam/status.d.ts +7 -0
  21. package/dist/carriers/ems-vietnam/status.js +55 -0
  22. package/dist/carriers/ems-vietnam/statuses.json +16 -0
  23. package/dist/carriers/israel-post/adapter.d.ts +14 -0
  24. package/dist/carriers/israel-post/adapter.js +57 -0
  25. package/dist/carriers/israel-post/carrier.json +40 -7
  26. package/dist/carriers/israel-post/parser.d.ts +6 -0
  27. package/dist/carriers/israel-post/parser.js +77 -0
  28. package/dist/carriers/israel-post/status.d.ts +4 -0
  29. package/dist/carriers/israel-post/status.js +15 -0
  30. package/dist/carriers/israel-post/statuses.json +37 -1
  31. package/dist/carriers/mayiyinfu/carrier.json +54 -0
  32. package/dist/carriers/mayiyinfu/numbers.json +17 -0
  33. package/dist/carriers/mayiyinfu/statuses.json +16 -0
  34. package/dist/carriers/pecom/adapter.d.ts +17 -0
  35. package/dist/carriers/pecom/adapter.js +60 -0
  36. package/dist/carriers/pecom/carrier.json +52 -7
  37. package/dist/carriers/pecom/parser.d.ts +13 -0
  38. package/dist/carriers/pecom/parser.js +214 -0
  39. package/dist/carriers/pecom/status.d.ts +7 -0
  40. package/dist/carriers/pecom/status.js +52 -0
  41. package/dist/carriers/pecom/statuses.json +9 -7
  42. package/dist/core/catalog/statusMaps.js +9 -4
  43. package/dist/data/catalog.json +56 -4
  44. package/dist/generated/catalog.d.ts +38 -5
  45. package/dist/generated/catalog.js +59 -5
  46. package/dist/generated/recognition.js +2 -0
  47. package/dist/generated/registry.js +13 -4
  48. package/dist/server/openapi.json +1 -1
  49. package/package.json +1 -1
@@ -12,7 +12,7 @@
12
12
  "access": "full_page"
13
13
  },
14
14
  "context": {
15
- "assessment": "candidate"
15
+ "assessment": "confirmed"
16
16
  },
17
17
  "expect": {
18
18
  "carrier": "unknown",
@@ -30,7 +30,7 @@
30
30
  "xpressbees"
31
31
  ]
32
32
  },
33
- "note": "A vc.ru post about a lost FivePost parcel gives it as the parcel's tracking number."
33
+ "note": "A vc.ru post about a lost FivePost parcel gives it as the parcel's tracking number; 5Post's app finds the order."
34
34
  },
35
35
  {
36
36
  "number": "99990023667453",
@@ -43,7 +43,7 @@
43
43
  "access": "indexed_excerpt"
44
44
  },
45
45
  "context": {
46
- "assessment": "candidate"
46
+ "assessment": "confirmed"
47
47
  },
48
48
  "expect": {
49
49
  "carrier": "unknown",
@@ -61,7 +61,7 @@
61
61
  "xpressbees"
62
62
  ]
63
63
  },
64
- "note": "Looked up on 5Post's own tracker, as an archived address shows; the capture was not opened because the page loads results by a CAPTCHA-gated request."
64
+ "note": "Looked up on 5Post's own tracker, as an archived address shows; 5Post's app finds the order."
65
65
  },
66
66
  {
67
67
  "number": "99990024107391",
@@ -74,7 +74,7 @@
74
74
  "access": "indexed_excerpt"
75
75
  },
76
76
  "context": {
77
- "assessment": "candidate"
77
+ "assessment": "confirmed"
78
78
  },
79
79
  "expect": {
80
80
  "carrier": "unknown",
@@ -92,7 +92,7 @@
92
92
  "xpressbees"
93
93
  ]
94
94
  },
95
- "note": "Looked up on 5Post's own tracker, as an archived address shows; the capture was not opened because the page loads results by a CAPTCHA-gated request."
95
+ "note": "Looked up on 5Post's own tracker, as an archived address shows; 5Post's app finds the order."
96
96
  },
97
97
  {
98
98
  "number": "99880000719762",
@@ -105,7 +105,7 @@
105
105
  "access": "indexed_excerpt"
106
106
  },
107
107
  "context": {
108
- "assessment": "candidate"
108
+ "assessment": "confirmed"
109
109
  },
110
110
  "expect": {
111
111
  "carrier": "unknown",
@@ -123,7 +123,7 @@
123
123
  "xpressbees"
124
124
  ]
125
125
  },
126
- "note": "Looked up on 5Post's own tracker, as an archived address shows; the capture was not opened because the page loads results by a CAPTCHA-gated request."
126
+ "note": "Looked up on 5Post's own tracker, as an archived address shows; 5Post's app finds the order."
127
127
  },
128
128
  {
129
129
  "number": "99880020264657",
@@ -136,7 +136,7 @@
136
136
  "access": "indexed_excerpt"
137
137
  },
138
138
  "context": {
139
- "assessment": "candidate"
139
+ "assessment": "confirmed"
140
140
  },
141
141
  "expect": {
142
142
  "carrier": "unknown",
@@ -154,7 +154,7 @@
154
154
  "xpressbees"
155
155
  ]
156
156
  },
157
- "note": "Looked up on 5Post's own tracker, as an archived address shows; the capture was not opened because the page loads results by a CAPTCHA-gated request."
157
+ "note": "Looked up on 5Post's own tracker, as an archived address shows; 5Post's app finds the order."
158
158
  },
159
159
  {
160
160
  "number": "99110007024671",
@@ -167,7 +167,7 @@
167
167
  "access": "indexed_excerpt"
168
168
  },
169
169
  "context": {
170
- "assessment": "candidate"
170
+ "assessment": "confirmed"
171
171
  },
172
172
  "expect": {
173
173
  "carrier": "unknown",
@@ -185,7 +185,7 @@
185
185
  "xpressbees"
186
186
  ]
187
187
  },
188
- "note": "Looked up on 5Post's own tracker, as an archived address shows; the capture was not opened because the page loads results by a CAPTCHA-gated request."
188
+ "note": "Looked up on 5Post's own tracker, as an archived address shows; 5Post's app finds the order."
189
189
  },
190
190
  {
191
191
  "number": "BX00000016018296FRW",
@@ -198,13 +198,13 @@
198
198
  "access": "indexed_excerpt"
199
199
  },
200
200
  "context": {
201
- "assessment": "candidate"
201
+ "assessment": "confirmed"
202
202
  },
203
203
  "expect": {
204
204
  "carrier": "unknown",
205
205
  "confidence": "none"
206
206
  },
207
- "note": "Looked up on 5Post's own tracker, as an archived address shows; the capture was not opened because the page loads results by a CAPTCHA-gated request."
207
+ "note": "Looked up on 5Post's own tracker, as an archived address shows; 5Post's app finds the order."
208
208
  },
209
209
  {
210
210
  "number": "BX00000016161928FRW",
@@ -217,13 +217,13 @@
217
217
  "access": "indexed_excerpt"
218
218
  },
219
219
  "context": {
220
- "assessment": "candidate"
220
+ "assessment": "confirmed"
221
221
  },
222
222
  "expect": {
223
223
  "carrier": "unknown",
224
224
  "confidence": "none"
225
225
  },
226
- "note": "Looked up on 5Post's own tracker, as an archived address shows; the capture was not opened because the page loads results by a CAPTCHA-gated request."
226
+ "note": "Looked up on 5Post's own tracker, as an archived address shows; 5Post's app finds the order."
227
227
  },
228
228
  {
229
229
  "number": "BX00000016412302FRW",
@@ -236,13 +236,13 @@
236
236
  "access": "indexed_excerpt"
237
237
  },
238
238
  "context": {
239
- "assessment": "candidate"
239
+ "assessment": "confirmed"
240
240
  },
241
241
  "expect": {
242
242
  "carrier": "unknown",
243
243
  "confidence": "none"
244
244
  },
245
- "note": "Looked up on 5Post's own tracker, as an archived address shows; the capture was not opened because the page loads results by a CAPTCHA-gated request."
245
+ "note": "Looked up on 5Post's own tracker, as an archived address shows; 5Post's app finds the order."
246
246
  },
247
247
  {
248
248
  "number": "P03321461309",
@@ -255,7 +255,7 @@
255
255
  "access": "indexed_excerpt"
256
256
  },
257
257
  "context": {
258
- "assessment": "candidate"
258
+ "assessment": "confirmed"
259
259
  },
260
260
  "expect": {
261
261
  "carrier": "unknown",
@@ -264,7 +264,7 @@
264
264
  "colis-prive"
265
265
  ]
266
266
  },
267
- "note": "Looked up on 5Post's own tracker, as an archived address shows; the capture was not opened because the page loads results by a CAPTCHA-gated request. Another capture of the same lookup names Avito as the shop."
267
+ "note": "Looked up on 5Post's own tracker, as an archived address shows; 5Post's app finds the order. Another capture of the same lookup names Avito as the shop."
268
268
  },
269
269
  {
270
270
  "number": "P06321818332",
@@ -277,7 +277,7 @@
277
277
  "access": "indexed_excerpt"
278
278
  },
279
279
  "context": {
280
- "assessment": "candidate"
280
+ "assessment": "confirmed"
281
281
  },
282
282
  "expect": {
283
283
  "carrier": "unknown",
@@ -286,7 +286,7 @@
286
286
  "colis-prive"
287
287
  ]
288
288
  },
289
- "note": "Looked up on 5Post's own tracker, as an archived address shows; the capture was not opened because the page loads results by a CAPTCHA-gated request. Another capture of the same lookup names Avito as the shop."
289
+ "note": "Looked up on 5Post's own tracker, as an archived address shows; 5Post's app finds the order. Another capture of the same lookup names Avito as the shop."
290
290
  }
291
291
  ]
292
292
  }
@@ -0,0 +1,23 @@
1
+ import type { CarrierResult } from '../../core/result/index.js';
2
+ export declare const PROVIDER = "5Post";
3
+ export declare const FIVE_POST_MAX_BYTES: number;
4
+ /**
5
+ * A 5Post number is the order number the shop gave the parcel, which 5Post
6
+ * matches whole and in upper case. Anything but letters and digits is not one.
7
+ */
8
+ export declare function normalizeFivePostNumber(raw: string): string;
9
+ /**
10
+ * The order 5Post lists under the whole number, from the reply of
11
+ * `GET /v3/mobile/order-tracking/{number}/orders`. An empty list is the app's
12
+ * "there is no order in the system". Shops choose their own numbers, so two
13
+ * shops' orders can share one; the app then lists both, and the website asks
14
+ * for the recipient's phone digits. Neither can be told apart here.
15
+ */
16
+ export declare function fivePostOrderId(payload: unknown, raw: string): string;
17
+ /**
18
+ * One order: its details from `GET /v3/mobile/order-tracking/{number}/orders/{orderId}`
19
+ * and its status history. The details must carry both the number and the
20
+ * order's id. Their `orderStatus` is the status the app heads the order with,
21
+ * and decides the stage; it can be newer than the history's last row.
22
+ */
23
+ export declare function parseFivePost(details: unknown, statuses: unknown, rawOrderId: string, raw: string): CarrierResult;
@@ -0,0 +1,164 @@
1
+ import { normalizeTrackingNumber } from '../../core/detection/index.js';
2
+ import { IndeterminateError, InvalidInputError, NotFoundError, SchemaError } from '../../core/errors/index.js';
3
+ import { lastMovement } from '../../core/result/pickup.js';
4
+ import { languageStageStatus } from '../../core/status/index.js';
5
+ import { explicitOffsetTime } from '../../core/time/index.js';
6
+ import { clean } from '../../core/transport/index.js';
7
+ import { isRecord } from '../../core/types.js';
8
+ import { fivePostStage, fivePostWording } from './status.js';
9
+ export const PROVIDER = '5Post';
10
+ // A short shop number can list a few dozen orders; an order or its history is a few kilobytes.
11
+ export const FIVE_POST_MAX_BYTES = 1024 * 1024;
12
+ // A shop's order number in letters and digits, of at least the three the app asks for.
13
+ const NUMBER = /^(?=[A-Z]*\d)[A-Z0-9]{3,40}$/;
14
+ const ORDER_ID = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/i;
15
+ const CODE = /^[A-Z][A-Z\d_]{0,79}$/;
16
+ // The warehouse a row names: "Обрабатывается на складе РЦ Казань", "Покинул склад РЦ Казань".
17
+ // "Покинул склад. Ожидайте поступления в пункт выдачи" names none.
18
+ const WAREHOUSE = /^(?:Обрабатывается на складе|Покинул склад)\s+([^\s.].*)$/u;
19
+ const WAREHOUSE_CODES = new Set(['WAREHOUSE_PROCESSING', 'READY_FOR_SHIPMENT']);
20
+ const MAX_ROWS = 500;
21
+ const MAX_EVENTS = 100;
22
+ /**
23
+ * A 5Post number is the order number the shop gave the parcel, which 5Post
24
+ * matches whole and in upper case. Anything but letters and digits is not one.
25
+ */
26
+ export function normalizeFivePostNumber(raw) {
27
+ const number = raw.length <= 64 ? normalizeTrackingNumber(raw) : '';
28
+ if (!NUMBER.test(number))
29
+ throw new InvalidInputError(PROVIDER, '5Post numbers are a shop\'s order number of three or more letters and digits');
30
+ return number;
31
+ }
32
+ /** An optional text field; anything but a string is a changed reply. */
33
+ function text(row, key, maxLength = 300) {
34
+ const value = row[key];
35
+ if (value === null || value === undefined)
36
+ return '';
37
+ if (typeof value !== 'string')
38
+ throw new SchemaError(PROVIDER, `5Post returned an invalid ${key}`);
39
+ return clean(value, maxLength);
40
+ }
41
+ const sameNumber = (value, number) => typeof value === 'string' && value.trim().toUpperCase() === number;
42
+ /**
43
+ * The order 5Post lists under the whole number, from the reply of
44
+ * `GET /v3/mobile/order-tracking/{number}/orders`. An empty list is the app's
45
+ * "there is no order in the system". Shops choose their own numbers, so two
46
+ * shops' orders can share one; the app then lists both, and the website asks
47
+ * for the recipient's phone digits. Neither can be told apart here.
48
+ */
49
+ export function fivePostOrderId(payload, raw) {
50
+ const number = normalizeFivePostNumber(raw);
51
+ if (!Array.isArray(payload))
52
+ throw new SchemaError(PROVIDER, '5Post returned a reply without its order list');
53
+ if (!payload.length)
54
+ throw new NotFoundError(PROVIDER);
55
+ const ids = new Set();
56
+ for (const order of payload) {
57
+ if (!isRecord(order) || typeof order.orderId !== 'string' || !ORDER_ID.test(order.orderId)) {
58
+ throw new SchemaError(PROVIDER, '5Post returned an invalid order');
59
+ }
60
+ if (sameNumber(order.clientOrderId, number))
61
+ ids.add(order.orderId.toLowerCase());
62
+ }
63
+ if (!ids.size)
64
+ throw new IndeterminateError(PROVIDER, '5Post answered for another shipment');
65
+ if (ids.size > 1)
66
+ throw new IndeterminateError(PROVIDER, '5Post holds several orders under this number');
67
+ return [...ids][0];
68
+ }
69
+ /**
70
+ * The status history of `GET /v3/mobile/orders/{orderId}/status-history`,
71
+ * oldest first. Every row has an instant with its offset. 5Post's own rows
72
+ * (`primaryStatus`) carry the order's id; the customs broker's do not, and can
73
+ * carry the broker's contacts, which are not kept, nor are location ids.
74
+ */
75
+ function history(payload, orderId) {
76
+ if (!Array.isArray(payload) || payload.length > MAX_ROWS)
77
+ throw new SchemaError(PROVIDER, '5Post returned an invalid status history');
78
+ const seen = new Set();
79
+ const rows = [];
80
+ payload.forEach((row, index) => {
81
+ if (!isRecord(row))
82
+ throw new SchemaError(PROVIDER, '5Post returned an invalid status');
83
+ // 5Post's own rows carry the order's id; the customs broker's rows come without one.
84
+ if (row.id === undefined && row.primaryStatus === true)
85
+ throw new SchemaError(PROVIDER, '5Post returned a status without its order');
86
+ if (row.id !== undefined && (typeof row.id !== 'string' || row.id.toLowerCase() !== orderId)) {
87
+ throw new IndeterminateError(PROVIDER, '5Post answered for another shipment');
88
+ }
89
+ const code = text(row, 'status', 80);
90
+ const at = explicitOffsetTime(row.changeDate);
91
+ if (!CODE.test(code) || !at)
92
+ throw new SchemaError(PROVIDER, '5Post returned a status without a code or clock');
93
+ const description = text(row, 'statusLocalized') || fivePostWording(code) || code;
94
+ const location = WAREHOUSE_CODES.has(code) ? WAREHOUSE.exec(description)?.[1]?.trim() : undefined;
95
+ const staged = fivePostStage(code, description);
96
+ const event = {
97
+ time: at.iso,
98
+ ...(location ? { location } : {}),
99
+ description,
100
+ ...(staged ? { stage: staged.stage, stage_source: staged.source } : {}),
101
+ provider_code: code,
102
+ };
103
+ const key = JSON.stringify(event);
104
+ if (seen.has(key))
105
+ return;
106
+ seen.add(key);
107
+ rows.push({ event, at: at.timestamp, index });
108
+ });
109
+ // Newest first; of two rows at one instant, the later in the reply is newer.
110
+ return rows.sort((left, right) => right.at - left.at || right.index - left.index).map((row) => row.event);
111
+ }
112
+ /**
113
+ * The point the parcel waits at, or was collected from: its name and address
114
+ * from the order's details. Only a pickup point or locker is named, never a
115
+ * door the parcel goes to.
116
+ */
117
+ function pickupPoint(details) {
118
+ const info = isRecord(details.locationInfo) ? details.locationInfo : null;
119
+ const receiver = info && isRecord(info.receiver) ? info.receiver : null;
120
+ if (!receiver || receiver.type !== 'PICKUP_POINT')
121
+ return '';
122
+ return [text(receiver, 'name', 160), text(receiver, 'address', 300)].filter(Boolean).join('\n');
123
+ }
124
+ /**
125
+ * One order: its details from `GET /v3/mobile/order-tracking/{number}/orders/{orderId}`
126
+ * and its status history. The details must carry both the number and the
127
+ * order's id. Their `orderStatus` is the status the app heads the order with,
128
+ * and decides the stage; it can be newer than the history's last row.
129
+ */
130
+ export function parseFivePost(details, statuses, rawOrderId, raw) {
131
+ const number = normalizeFivePostNumber(raw);
132
+ const orderId = rawOrderId.toLowerCase();
133
+ if (!isRecord(details))
134
+ throw new SchemaError(PROVIDER, '5Post returned invalid order details');
135
+ if (typeof details.orderId !== 'string' || details.orderId.toLowerCase() !== orderId || !sameNumber(details.clientOrderId, number)) {
136
+ throw new IndeterminateError(PROVIDER, '5Post answered for another shipment');
137
+ }
138
+ const status = text(details, 'orderStatus', 80);
139
+ if (!CODE.test(status))
140
+ throw new SchemaError(PROVIDER, '5Post returned an order without its status');
141
+ const events = history(statuses, orderId);
142
+ const wording = events.find((event) => event.provider_code === status)?.description ?? fivePostWording(status) ?? status;
143
+ const current = fivePostStage(status, wording);
144
+ const stage = current?.stage;
145
+ const assigned = explicitOffsetTime(details.orderStatusAssignmentDate);
146
+ const newest = events[0] ? explicitOffsetTime(events[0].time) : null;
147
+ const updated = assigned && (!newest || assigned.timestamp > newest.timestamp) ? assigned : newest;
148
+ const delivered = stage === 'delivered' ? events.find((event) => event.stage === 'delivered') : undefined;
149
+ const deliveredAt = delivered?.time ?? (stage === 'delivered' ? assigned?.iso : undefined);
150
+ const collected = delivered !== undefined && lastMovement(events.slice(events.indexOf(delivered) + 1)) === 'ready_for_pickup';
151
+ const point = stage === 'ready_for_pickup' || collected ? pickupPoint(details) : '';
152
+ return {
153
+ status: stage ? languageStageStatus(stage) : 'unknown',
154
+ ...(current ? { current_stage: current.stage, current_stage_source: current.source } : {}),
155
+ last_status_text: wording,
156
+ ...(events.length ? {} : { provider_code: status, summary_only: true }),
157
+ last_update: updated?.iso ?? null,
158
+ expected_delivery: null,
159
+ ...(deliveredAt ? { delivered_at: deliveredAt } : {}),
160
+ ...(point ? { pickup_point: point } : {}),
161
+ events: events.slice(0, MAX_EVENTS),
162
+ ...(events.length > MAX_EVENTS ? { history_truncated: true } : {}),
163
+ };
164
+ }
@@ -0,0 +1,9 @@
1
+ import { type ClassifiedWording, type Stage } from '../../core/status/index.js';
2
+ import type { CarrierStatusMap } from '../../core/status/statusMap.js';
3
+ /** The stage the map gives a status code. */
4
+ export declare function fivePostMappedStage(code: string): Stage | undefined;
5
+ /** How the app words a status code, when the map knows it. */
6
+ export declare function fivePostWording(code: string): string | undefined;
7
+ /** A status's stage: its code, else the shared wording rules for a code the map does not know, else nothing. */
8
+ export declare function fivePostStage(code: string, wording: string): ClassifiedWording | null;
9
+ export declare const statusMap: CarrierStatusMap;
@@ -0,0 +1,100 @@
1
+ import { classifyWording } from '../../core/status/index.js';
2
+ /**
3
+ * The order statuses of 5Post's app, as its `GET /v3/mobile/order-statuses`
4
+ * words them. A history row names the warehouse in the wording of
5
+ * WAREHOUSE_PROCESSING and READY_FOR_SHIPMENT, such as "Покинул склад РЦ …".
6
+ * An uncollected parcel's statuses start with "Не востребован" and a
7
+ * cancelled order's with "Отменён"; such a parcel is on its way back, though
8
+ * one taken from its pickup point can still be sent to another point.
9
+ */
10
+ const CODES = new Map([
11
+ ['INFORMATION_RECEIVED', ['registered', 'Ожидается передача заказа в 5post']],
12
+ ['INCEPTION_PROBLEM', ['exception', 'Проблема']],
13
+ ['PROCESS_WITHDRAWN', ['accepted', 'Передан службе доставки']], // The sender left the parcel at a pickup point.
14
+ ['WAREHOUSE_PROCESSING', ['in_transit', 'Обрабатывается на складе']],
15
+ ['READY_FOR_SHIPMENT', ['in_transit', 'Покинул склад']],
16
+ ['DELIVERED', ['ready_for_pickup', 'Доставлен в пункт выдачи']], // Waiting at the pickup point or locker.
17
+ ['DONE', ['delivered', 'Получен']],
18
+ ['UNCLAIMED_APPROVED', ['returned', 'Не востребован. Ожидается передача заказа в 5post']],
19
+ ['UNCLAIMED_TRANSFERRED_TO_DELIVERY_SERVICE', ['returned', 'Не востребован. Передан службе доставки']],
20
+ ['UNCLAIMED_RECEIVED_IN_WAREHOUSE', ['returned', 'Не востребован. Обрабатывается на складе']],
21
+ ['UNCLAIMED_SHIPPED', ['returned', 'Не востребован. Покинул склад']],
22
+ ['UNCLAIMED_RETURN_TO_PARTNER', ['returned', 'Возвращен партнеру']],
23
+ ['UNCLAIMED_PLACED_IN_POSTAMAT', ['returned', 'Не востребован. Доставлен в пункт выдачи']], // At a point for the sender.
24
+ ['UNCLAIMED_READY_FOR_REPICKUP', ['in_transit', 'Готов к повторной доставке']], // To be sent to a pickup point again.
25
+ ['UNCLAIMED_RECEIVED_IN_COURIER_WAREHOUSE', ['returned', 'Не востребован. Обрабатывается на складе курьерской службы']],
26
+ ['UNCLAIMED_RETURNING_TO_PARTNER', ['returned', 'Не востребован. Возвращается отправителю']],
27
+ ['RETURNING_BY_EXPRESS_DELIVERY', ['returned', 'Не востребован. Возвращается курьерской службой']],
28
+ ['LOST', ['exception', 'Утерян']],
29
+ ['UTILIZED', ['exception', 'Утилизирован']],
30
+ ['CANCELLED', ['exception', 'Отменен']],
31
+ ['CANCELLED_APPROVED', ['exception', 'Отменён. Ожидается передача заказа в 5post']], // Cancelled before 5Post had it.
32
+ ['CANCELLED_TRANSFERRED_TO_DELIVERY_SERVICE', ['returned', 'Отменён. Передан службе доставки']],
33
+ ['CANCELLED_SHIPPED', ['returned', 'Отменён. Покинул склад']],
34
+ ['CANCELLED_RECEIVED_IN_WAREHOUSE', ['returned', 'Отменён. Обрабатывается на складе']],
35
+ ['CANCELLED_PLACED_IN_POSTAMAT', ['returned', 'Отменён. Доставлен в пункт выдачи']],
36
+ ['CANCELLED_RETURNING_BY_COURIER', ['returned', 'Отменен. Возвращается курьером']],
37
+ ['CANCELLED_RETURNING_TO_PARTNER', ['returned', 'Отменен. Возвращается отправителю']],
38
+ ['CANCELLED_IN_INTERNATIONAL_TRANSIT', ['exception', 'Отменён. Обратитесь к продавцу']],
39
+ ['RETURNED_TO_PARTNER', ['returned', 'Отправлен в интернет-магазин']],
40
+ ['RETURNED_TO_CLIENT', ['returned', 'Возвращен отправителю']],
41
+ ['REGISTRATION_ERROR_INCORRECT_PHONE_NUMBER', ['exception', 'Ошибка регистрации заказа: требуется уточнить номер телефона']],
42
+ ['REGISTRATION_ERROR_INCORRECT_DELIVERY_DATE', ['exception', 'Ошибка регистрации заказа: требуется уточнить дату доставки']],
43
+ ['REGISTRATION_ERROR_INCORRECT_CLIENT_ADDRESS', ['exception', 'Ошибка регистрации заказа: требуется уточнить адрес доставки']],
44
+ // Courier delivery to the door.
45
+ ['EXPRESS_DELIVERY_PREPARATION', ['in_transit', 'Подготовка к передаче курьерской службе']],
46
+ ['RECEIVED_BY_EXPRESS_DELIVERY', ['in_transit', 'Передан курьерской службе']],
47
+ ['RECEIVED_IN_COURIER_WAREHOUSE', ['in_transit', 'Обрабатывается на складе курьерской службы']],
48
+ ['RECEIVED_BY_COURIER', ['out_for_delivery', 'Передан курьеру']],
49
+ ['RETURNING_BY_COURIER', ['failed_attempt', 'Неуспешная попытка вручения']],
50
+ ['RECEIVED_IN_WAREHOUSE_AFTER_ATTEMPTED_DELIVERY', ['failed_attempt', 'Вернулся после неуспешной попытки доставки на склад партнера']],
51
+ // Parcels from abroad. The customs rows are the broker's, beside 5Post's own.
52
+ ['CUSTOMS_AWAITING_PAYMENT', ['customs', 'Требуется оплата таможенных платежей']],
53
+ ['CUSTOMS_CLEARANCE_STARTED', ['customs', 'Начато таможенное оформление']],
54
+ ['CUSTOMS_CLEARANCE_COMPLETED', ['in_transit', 'Таможенное оформление завершено']],
55
+ ['CUSTOMS_DATA_REQUIRED', ['customs', 'Требуется предоставить данные таможенному представителю']],
56
+ ['CUSTOMS_CLEARANCE_REJECTED', ['exception', 'Отказано таможней в выпуске']],
57
+ ['CUSTOMS_SENT_TO_COURIER', ['in_transit', 'Подготовлено к передаче 5post']],
58
+ ['CUSTOMS_RETURNED_TO_STORE', ['returned', 'Возврат в интернет-магазин']],
59
+ ['IN_INTERNATIONAL_TRANSIT_SHIPPED_FROM_WAREHOUSE', ['in_transit', 'В пути на таможню в стране отправления. Обычно занимает до 10 дней']],
60
+ ['IN_INTERNATIONAL_TRANSIT_CUSTOMS_CLEARANCE_STARTED_ORIG', ['customs', 'Начато таможенное оформление в стране отправления']],
61
+ ['IN_INTERNATIONAL_TRANSIT_CUSTOMS_CLEARANCE_COMPLETED', ['in_transit', 'Таможенное оформление завершено']],
62
+ ['IN_INTERNATIONAL_TRANSIT_LINEHAUL_TRANSIT_DEPARTURE', ['in_transit', 'Отправлен в страну назначения']],
63
+ ['IN_INTERNATIONAL_TRANSIT_CUSTOMS_CLEARANCE_STARTED_DEST', ['customs', 'Начато таможенное оформление в стране назначения']],
64
+ ['IN_INTERNATIONAL_TRANSIT_DATA_REQUIRED', ['customs', 'Требуется предоставить данные таможенному представителю']],
65
+ ['IN_INTERNATIONAL_TRANSIT_READY_FOR_5POST', ['in_transit', 'Подготовлено к передаче 5post']],
66
+ ['RECEIVED_BY_AIR_CARRIER', ['in_transit', 'Передан авиаперевозчику']],
67
+ ['DEPARTED_BY_AIR', ['in_transit', 'Отправлен авиарейсом']],
68
+ ['DELIVERED_BY_AIR', ['in_transit', 'Доставлен авиарейсом']],
69
+ ['RETURNING_BY_AIR_CARRIER', ['returned', 'Возвращается авиаперевозчиком']],
70
+ ]);
71
+ /** Statuses that say nothing about where the parcel is or how its journey ended. */
72
+ const UNSTAGED = new Map([
73
+ ['UNDEFINED', 'В работе'],
74
+ ['COMPLETED_BY_PARTNER', 'Заказ перешел в терминальный статус на стороне партнера'],
75
+ ]);
76
+ /** The stage the map gives a status code. */
77
+ export function fivePostMappedStage(code) {
78
+ return CODES.get(code)?.[0];
79
+ }
80
+ /** How the app words a status code, when the map knows it. */
81
+ export function fivePostWording(code) {
82
+ return CODES.get(code)?.[1] ?? UNSTAGED.get(code);
83
+ }
84
+ /** A status's stage: its code, else the shared wording rules for a code the map does not know, else nothing. */
85
+ export function fivePostStage(code, wording) {
86
+ const mapped = fivePostMappedStage(code);
87
+ if (mapped)
88
+ return { stage: mapped, source: 'carrier_map' };
89
+ if (UNSTAGED.has(code))
90
+ return null;
91
+ const worded = classifyWording(wording, 'in_transit');
92
+ return worded.source === 'none' ? null : worded;
93
+ }
94
+ export const statusMap = {
95
+ stage: (code) => (code ? fivePostMappedStage(code) : undefined),
96
+ gaps: [
97
+ { code: 'UNDEFINED', note: '"В работе", in progress: an order status that says nothing of where the parcel is. One followed a loss in the history.' },
98
+ { code: 'COMPLETED_BY_PARTNER', note: 'The sender closed the order on its side, which does not say whether the parcel was delivered or went back.' },
99
+ ],
100
+ };
@@ -15,9 +15,69 @@
15
15
  {"code": "READY_FOR_WITHDRAW_FROM_PICKUP_POINT", "wording": "Готов к изъятию из пункта выдачи", "stage": "returned", "language": "ru", "confirmedBy": "source", "note": "Label an open-source 5Post API client gives this API status; the public tracker's own wording was not seen. The parcel was not collected and is due to be taken back from the pickup point."},
16
16
  {"code": "WITHDRAWN_FROM_PICKUP_POINT", "wording": "Изъят из пункта выдачи", "stage": "returned", "language": "ru", "confirmedBy": "source", "note": "Label an open-source 5Post API client gives this API status; the public tracker's own wording was not seen. An uncollected parcel was taken back from the pickup point."},
17
17
  {"code": "WAITING_FOR_REPICKUP", "wording": "Ожидает повторную выдачу", "stage": "ready_for_pickup", "language": "ru", "confirmedBy": "source", "note": "Label an open-source 5Post API client gives this API status; the public tracker's own wording was not seen."},
18
- {"code": "LOST", "wording": "Утерян", "stage": "exception", "language": "ru", "confirmedBy": "source", "note": "Label an open-source 5Post API client gives this API status; the public tracker's own wording was not seen."},
19
- {"code": "CANCELLED", "wording": "Отменен", "stage": "exception", "language": "ru", "confirmedBy": "source", "note": "Label an open-source 5Post API client gives this API status; the public tracker's own wording was not seen."},
20
18
  {"code": "RETURNED_TO_PARTNER", "wording": "Отгружен партнеру", "stage": "returned", "language": "ru", "confirmedBy": "source", "note": "Label an open-source 5Post API client gives this API status; the public tracker's own wording was not seen. Handed back to the sending merchant."},
21
- {"code": "UNCLAIMED", "wording": "Не востребован", "stage": "returned", "language": "ru", "confirmedBy": "source", "note": "Label an open-source 5Post API client gives this API status; the public tracker's own wording was not seen. A main order status: the recipient never collected the parcel."}
19
+ {"code": "UNCLAIMED", "wording": "Не востребован", "stage": "returned", "language": "ru", "confirmedBy": "source", "note": "Label an open-source 5Post API client gives this API status; the public tracker's own wording was not seen. A main order status: the recipient never collected the parcel."},
20
+ {"code": "UNDEFINED", "wording": "В работе", "unmapped": true, "language": "ru", "confirmedBy": "live", "note": "\"In progress\": an order status that says nothing of where the parcel is. One order had it as its status long after its history reported a loss."},
21
+ {"code": "INFORMATION_RECEIVED", "wording": "Ожидается передача заказа в 5post", "stage": "registered", "language": "ru", "confirmedBy": "live", "note": "The sender registered the order; 5Post does not have the parcel yet."},
22
+ {"code": "INCEPTION_PROBLEM", "wording": "Проблема", "stage": "exception", "language": "ru", "confirmedBy": "live", "note": "A problem with the order. Seen just before a loss, and before an order was registered again."},
23
+ {"code": "WAREHOUSE_PROCESSING", "wording": "Обрабатывается на складе", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "At a 5Post warehouse; the history's wording names it."},
24
+ {"code": "READY_FOR_SHIPMENT", "wording": "Покинул склад", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "Left a warehouse; the history's wording names it, or says the parcel is on its way to the pickup point."},
25
+ {"code": "DELIVERED", "wording": "Доставлен в пункт выдачи", "stage": "ready_for_pickup", "language": "ru", "confirmedBy": "live", "note": "Arrived at the pickup point or locker and waits there for the recipient until the order's storage deadline."},
26
+ {"code": "DONE", "wording": "Получен", "stage": "delivered", "language": "ru", "confirmedBy": "live", "note": "Collected by the recipient."},
27
+ {"code": "UNCLAIMED_APPROVED", "wording": "Не востребован. Ожидается передача заказа в 5post", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
28
+ {"code": "UNCLAIMED_TRANSFERRED_TO_DELIVERY_SERVICE", "wording": "Не востребован. Передан службе доставки", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "Not collected by the storage deadline and taken from the pickup point. One such parcel was later sent to a pickup point again and collected."},
29
+ {"code": "UNCLAIMED_RECEIVED_IN_WAREHOUSE", "wording": "Не востребован. Обрабатывается на складе", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "An uncollected parcel back at a warehouse."},
30
+ {"code": "UNCLAIMED_SHIPPED", "wording": "Не востребован. Покинул склад", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
31
+ {"code": "UNCLAIMED_RETURN_TO_PARTNER", "wording": "Возвращен партнеру", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
32
+ {"code": "UNCLAIMED_PLACED_IN_POSTAMAT", "wording": "Не востребован. Доставлен в пункт выдачи", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "An uncollected parcel at a pickup point for its sender to collect. In the status list the app loads; not seen in a history."},
33
+ {"code": "LOST", "wording": "Утерян", "stage": "exception", "language": "ru", "confirmedBy": "live", "note": "Reported lost. The same code and wording are the partner API's."},
34
+ {"code": "UNCLAIMED_READY_FOR_REPICKUP", "wording": "Готов к повторной доставке", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "An uncollected parcel to be sent to a pickup point again. In the status list the app loads; not seen in a history."},
35
+ {"code": "CANCELLED", "wording": "Отменен", "stage": "exception", "language": "ru", "confirmedBy": "live", "note": "The order was cancelled. The same code and wording are the partner API's. In the status list the app loads; not seen in a history."},
36
+ {"code": "CANCELLED_APPROVED", "wording": "Отменён. Ожидается передача заказа в 5post", "stage": "exception", "language": "ru", "confirmedBy": "live", "note": "The order was cancelled before 5Post had the parcel. In the status list the app loads; not seen in a history."},
37
+ {"code": "CANCELLED_TRANSFERRED_TO_DELIVERY_SERVICE", "wording": "Отменён. Передан службе доставки", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
38
+ {"code": "CANCELLED_SHIPPED", "wording": "Отменён. Покинул склад", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
39
+ {"code": "CANCELLED_RECEIVED_IN_WAREHOUSE", "wording": "Отменён. Обрабатывается на складе", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
40
+ {"code": "CANCELLED_PLACED_IN_POSTAMAT", "wording": "Отменён. Доставлен в пункт выдачи", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
41
+ {"code": "RETURNING_BY_EXPRESS_DELIVERY", "wording": "Не востребован. Возвращается курьерской службой", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
42
+ {"code": "RECEIVED_BY_EXPRESS_DELIVERY", "wording": "Передан курьерской службе", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
43
+ {"code": "EXPRESS_DELIVERY_PREPARATION", "wording": "Подготовка к передаче курьерской службе", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
44
+ {"code": "REGISTRATION_ERROR_INCORRECT_PHONE_NUMBER", "wording": "Ошибка регистрации заказа: требуется уточнить номер телефона", "stage": "exception", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
45
+ {"code": "REGISTRATION_ERROR_INCORRECT_DELIVERY_DATE", "wording": "Ошибка регистрации заказа: требуется уточнить дату доставки", "stage": "exception", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
46
+ {"code": "REGISTRATION_ERROR_INCORRECT_CLIENT_ADDRESS", "wording": "Ошибка регистрации заказа: требуется уточнить адрес доставки", "stage": "exception", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
47
+ {"code": "PROCESS_WITHDRAWN", "wording": "Передан службе доставки", "stage": "accepted", "language": "ru", "confirmedBy": "live", "note": "The parcel was handed to 5Post, such as a parcel one person sends another left at a shop's till."},
48
+ {"code": "RETURNED_TO_PARTNER", "wording": "Отправлен в интернет-магазин", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
49
+ {"code": "RETURNED_TO_CLIENT", "wording": "Возвращен отправителю", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
50
+ {"code": "UTILIZED", "wording": "Утилизирован", "stage": "exception", "language": "ru", "confirmedBy": "live", "note": "Disposed of. In the status list the app loads; not seen in a history."},
51
+ {"code": "CUSTOMS_AWAITING_PAYMENT", "wording": "Требуется оплата таможенных платежей", "stage": "customs", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
52
+ {"code": "CUSTOMS_CLEARANCE_STARTED", "wording": "Начато таможенное оформление", "stage": "customs", "language": "ru", "confirmedBy": "live", "note": "A customs broker's row for a parcel from abroad."},
53
+ {"code": "CUSTOMS_CLEARANCE_COMPLETED", "wording": "Таможенное оформление завершено", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "A customs broker's row: the parcel was cleared and moves on."},
54
+ {"code": "CUSTOMS_DATA_REQUIRED", "wording": "Требуется предоставить данные таможенному представителю", "stage": "customs", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
55
+ {"code": "CUSTOMS_CLEARANCE_REJECTED", "wording": "Отказано таможней в выпуске", "stage": "exception", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
56
+ {"code": "CUSTOMS_SENT_TO_COURIER", "wording": "Подготовлено к передаче 5post", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "A customs broker's row: the cleared parcel is to be handed to 5Post."},
57
+ {"code": "CUSTOMS_RETURNED_TO_STORE", "wording": "Возврат в интернет-магазин", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
58
+ {"code": "RECEIVED_IN_COURIER_WAREHOUSE", "wording": "Обрабатывается на складе курьерской службы", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
59
+ {"code": "RECEIVED_BY_COURIER", "wording": "Передан курьеру", "stage": "out_for_delivery", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
60
+ {"code": "RETURNING_BY_COURIER", "wording": "Неуспешная попытка вручения", "stage": "failed_attempt", "language": "ru", "confirmedBy": "live", "note": "A courier's failed attempt to deliver to the door. In the status list the app loads; not seen in a history."},
61
+ {"code": "CANCELLED_RETURNING_BY_COURIER", "wording": "Отменен. Возвращается курьером", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
62
+ {"code": "CANCELLED_RETURNING_TO_PARTNER", "wording": "Отменен. Возвращается отправителю", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
63
+ {"code": "UNCLAIMED_RECEIVED_IN_COURIER_WAREHOUSE", "wording": "Не востребован. Обрабатывается на складе курьерской службы", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
64
+ {"code": "UNCLAIMED_RETURNING_TO_PARTNER", "wording": "Не востребован. Возвращается отправителю", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
65
+ {"code": "IN_INTERNATIONAL_TRANSIT_SHIPPED_FROM_WAREHOUSE", "wording": "В пути на таможню в стране отправления. Обычно занимает до 10 дней", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
66
+ {"code": "CANCELLED_IN_INTERNATIONAL_TRANSIT", "wording": "Отменён. Обратитесь к продавцу", "stage": "exception", "language": "ru", "confirmedBy": "live", "note": "Cancelled on its way from abroad; the recipient is told to ask the seller. In the status list the app loads; not seen in a history."},
67
+ {"code": "IN_INTERNATIONAL_TRANSIT_CUSTOMS_CLEARANCE_STARTED_ORIG", "wording": "Начато таможенное оформление в стране отправления", "stage": "customs", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
68
+ {"code": "IN_INTERNATIONAL_TRANSIT_CUSTOMS_CLEARANCE_COMPLETED", "wording": "Таможенное оформление завершено", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
69
+ {"code": "IN_INTERNATIONAL_TRANSIT_LINEHAUL_TRANSIT_DEPARTURE", "wording": "Отправлен в страну назначения", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
70
+ {"code": "IN_INTERNATIONAL_TRANSIT_CUSTOMS_CLEARANCE_STARTED_DEST", "wording": "Начато таможенное оформление в стране назначения", "stage": "customs", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
71
+ {"code": "IN_INTERNATIONAL_TRANSIT_DATA_REQUIRED", "wording": "Требуется предоставить данные таможенному представителю", "stage": "customs", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
72
+ {"code": "IN_INTERNATIONAL_TRANSIT_READY_FOR_5POST", "wording": "Подготовлено к передаче 5post", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
73
+ {"code": "COMPLETED_BY_PARTNER", "wording": "Заказ перешел в терминальный статус на стороне партнера", "unmapped": true, "language": "ru", "confirmedBy": "live", "note": "The sender closed the order on its side, which does not say whether the parcel was delivered or went back. In the status list the app loads; not seen in a history."},
74
+ {"code": "RECEIVED_IN_WAREHOUSE_AFTER_ATTEMPTED_DELIVERY", "wording": "Вернулся после неуспешной попытки доставки на склад партнера", "stage": "failed_attempt", "language": "ru", "confirmedBy": "live", "note": "Back at the sender's warehouse after a failed delivery to the door. In the status list the app loads; not seen in a history."},
75
+ {"code": "RECEIVED_BY_AIR_CARRIER", "wording": "Передан авиаперевозчику", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
76
+ {"code": "DEPARTED_BY_AIR", "wording": "Отправлен авиарейсом", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
77
+ {"code": "DELIVERED_BY_AIR", "wording": "Доставлен авиарейсом", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
78
+ {"code": "RETURNING_BY_AIR_CARRIER", "wording": "Возвращается авиаперевозчиком", "stage": "returned", "language": "ru", "confirmedBy": "live", "note": "In the status list the app loads; not seen in a history."},
79
+ {"code": "WAREHOUSE_PROCESSING", "wording": "Обрабатывается на складе РЦ Самара", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "The warehouse rows name the distribution centre (РЦ) or hub (ХАБ)."},
80
+ {"code": "READY_FOR_SHIPMENT", "wording": "Покинул склад РЦ Кстово", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "Left the named distribution centre."},
81
+ {"code": "READY_FOR_SHIPMENT", "wording": "Покинул склад. Ожидайте поступления в пункт выдачи", "stage": "in_transit", "language": "ru", "confirmedBy": "live", "note": "Left the last warehouse for the pickup point."}
22
82
  ]
23
83
  }
@@ -0,0 +1,17 @@
1
+ import { type AdapterFactory, type TrackingContext } from '../../core/adapter/index.js';
2
+ import type { CarrierResult } from '../../core/result/index.js';
3
+ import { type StepRecorder } from '../../core/telemetry/index.js';
4
+ /** The lookup the tracking page on ems.com.vn makes for the number typed in. */
5
+ export declare const EMS_VIETNAM_API = "https://api.myems.vn/TrackAndTraceItemCode";
6
+ /** The address the page asks: the number with `EMS` after it, and the Vietnamese wording. */
7
+ export declare function emsVietnamLookupUrl(number: string): string;
8
+ export declare class EmsVietnamTracker {
9
+ private readonly options;
10
+ constructor(options?: {
11
+ fetcher?: typeof fetch;
12
+ recorder?: StepRecorder;
13
+ userAgent?: string;
14
+ });
15
+ fetch(raw: string, context?: TrackingContext): Promise<CarrierResult>;
16
+ }
17
+ export declare const adapter: AdapterFactory;