@cimplify/sdk 0.79.0 → 0.81.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.
- package/dist/advanced.d.mts +1 -1
- package/dist/advanced.d.ts +1 -1
- package/dist/advanced.js +20 -20
- package/dist/advanced.mjs +1 -1
- package/dist/{chunk-3BKMNVTR.mjs → chunk-7BM56JET.mjs} +1 -0
- package/dist/{chunk-FURKCWVG.mjs → chunk-7PAQR3VC.mjs} +2 -2
- package/dist/{chunk-BNA4GW4D.mjs → chunk-BRVIXGUW.mjs} +60 -0
- package/dist/{chunk-5BPBDWAA.js → chunk-GFM5JW45.js} +57 -36
- package/dist/{chunk-CV5QMDQS.js → chunk-HPN5R3K2.js} +1 -0
- package/dist/{chunk-T7ALPOK7.js → chunk-IZDJEDR4.js} +4 -4
- package/dist/{chunk-LBFTEXGD.mjs → chunk-NWUEWUX2.mjs} +22 -1
- package/dist/{chunk-OSTOGR4F.js → chunk-SRJEMEVZ.js} +60 -0
- package/dist/{client-Cn5trGYV.d.ts → client-BmDNlUMx.d.ts} +44 -2
- package/dist/{client-Byysg2IX.d.mts → client-C51FFhDz.d.mts} +2 -2
- package/dist/{client-D16qfHAB.d.mts → client-Cx3WLhMj.d.mts} +44 -2
- package/dist/{client-BAzvXSLJ.d.ts → client-Q_m-GkTl.d.ts} +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +69 -69
- package/dist/index.mjs +3 -3
- package/dist/mock/cli.mjs +60 -0
- package/dist/mock/library.js +60 -0
- package/dist/mock/library.mjs +60 -0
- package/dist/mock/msw.js +60 -0
- package/dist/mock/msw.mjs +60 -0
- package/dist/react.d.mts +51 -4
- package/dist/react.d.ts +51 -4
- package/dist/react.js +371 -65
- package/dist/react.mjs +337 -53
- package/dist/{server-Daq42vK7.d.ts → server-N4Q24CnO.d.ts} +21 -0
- package/dist/{server-CGO4zneR.d.mts → server-hP9NLtTh.d.mts} +21 -0
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +7 -7
- package/dist/server.mjs +2 -2
- package/dist/testing/msw.d.mts +1 -1
- package/dist/testing/msw.d.ts +1 -1
- package/dist/testing/msw.js +2 -2
- package/dist/testing/msw.mjs +1 -1
- package/dist/testing/suite.d.mts +4 -4
- package/dist/testing/suite.d.ts +4 -4
- package/dist/testing/suite.js +23 -23
- package/dist/testing/suite.mjs +4 -4
- package/dist/testing.d.mts +18 -18
- package/dist/testing.d.ts +18 -18
- package/dist/testing.js +79 -79
- package/dist/testing.mjs +5 -5
- package/package.json +7 -2
- package/registry/catalogue-page.json +1 -1
- package/registry/product-card.json +1 -1
- package/registry/product-grid.json +1 -1
- package/registry/product-image-gallery.json +1 -1
- package/registry/product-page.json +1 -1
- package/registry/recently-viewed.json +1 -1
- package/registry/recommendation-carousel.json +1 -1
- package/registry/search-input.json +1 -1
- package/dist/server-BXT62nBC.d.mts +0 -1186
- package/dist/server-BXT62nBC.d.ts +0 -1186
package/dist/advanced.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { k as AuthService, C as BusinessService, P as CartOperations, Q as CatalogueQueries, a9 as CheckoutOperations, a9 as CheckoutService, af as CimplifyElement, ag as CimplifyElements,
|
|
1
|
+
export { k as AuthService, C as BusinessService, P as CartOperations, Q as CatalogueQueries, a9 as CheckoutOperations, a9 as CheckoutService, af as CimplifyElement, ag as CimplifyElements, aH as ELEMENT_TYPES, aI as EVENT_TYPES, aL as ElementEventType, aM as ElementOptions, aN as ElementType, aV as ElementsOptions, b1 as FetchQuoteInput, b9 as FxService, bd as GetProductsOptions, bg as InventoryService, bn as LinkService, br as LiteService, by as MESSAGE_TYPES, b$ as OrderQueries, ci as PriceQuote, co as QuoteBundleSelectionInput, cp as QuoteCompositeSelectionInput, cq as QuoteDynamicBuckets, cr as QuoteStatus, cs as QuoteUiMessage, cu as RefreshQuoteInput, cv as RefreshQuoteResult, cW as SchedulingService, dB as createElements } from './client-Cx3WLhMj.mjs';
|
|
2
2
|
import './product-BgFOFmQw.mjs';
|
|
3
3
|
import './payment-B7qzWdaJ.mjs';
|
|
4
4
|
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { k as AuthService, C as BusinessService, P as CartOperations, Q as CatalogueQueries, a9 as CheckoutOperations, a9 as CheckoutService, af as CimplifyElement, ag as CimplifyElements,
|
|
1
|
+
export { k as AuthService, C as BusinessService, P as CartOperations, Q as CatalogueQueries, a9 as CheckoutOperations, a9 as CheckoutService, af as CimplifyElement, ag as CimplifyElements, aH as ELEMENT_TYPES, aI as EVENT_TYPES, aL as ElementEventType, aM as ElementOptions, aN as ElementType, aV as ElementsOptions, b1 as FetchQuoteInput, b9 as FxService, bd as GetProductsOptions, bg as InventoryService, bn as LinkService, br as LiteService, by as MESSAGE_TYPES, b$ as OrderQueries, ci as PriceQuote, co as QuoteBundleSelectionInput, cp as QuoteCompositeSelectionInput, cq as QuoteDynamicBuckets, cr as QuoteStatus, cs as QuoteUiMessage, cu as RefreshQuoteInput, cv as RefreshQuoteResult, cW as SchedulingService, dB as createElements } from './client-BmDNlUMx.js';
|
|
2
2
|
import './product-BgFOFmQw.js';
|
|
3
3
|
import './payment-mVIJIJcq.js';
|
|
4
4
|
|
package/dist/advanced.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHPN5R3K2_js = require('./chunk-HPN5R3K2.js');
|
|
4
4
|
require('./chunk-7Y2O3E4D.js');
|
|
5
5
|
require('./chunk-XA3ZNR75.js');
|
|
6
6
|
require('./chunk-OWW5GUSB.js');
|
|
@@ -9,77 +9,77 @@ require('./chunk-OWW5GUSB.js');
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "AuthService", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkHPN5R3K2_js.AuthService; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "BusinessService", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkHPN5R3K2_js.BusinessService; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "CartOperations", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkHPN5R3K2_js.CartOperations; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "CatalogueQueries", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkHPN5R3K2_js.CatalogueQueries; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "CheckoutOperations", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkHPN5R3K2_js.CheckoutService; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "CheckoutService", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunkHPN5R3K2_js.CheckoutService; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "CimplifyElement", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunkHPN5R3K2_js.CimplifyElement; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "CimplifyElements", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunkHPN5R3K2_js.CimplifyElements; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "ELEMENT_TYPES", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunkHPN5R3K2_js.ELEMENT_TYPES; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "EVENT_TYPES", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunkHPN5R3K2_js.EVENT_TYPES; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "FxService", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkHPN5R3K2_js.FxService; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "InventoryService", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunkHPN5R3K2_js.InventoryService; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "LinkService", {
|
|
59
59
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunkHPN5R3K2_js.LinkService; }
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "LiteService", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunkHPN5R3K2_js.LiteService; }
|
|
65
65
|
});
|
|
66
66
|
Object.defineProperty(exports, "MESSAGE_TYPES", {
|
|
67
67
|
enumerable: true,
|
|
68
|
-
get: function () { return
|
|
68
|
+
get: function () { return chunkHPN5R3K2_js.MESSAGE_TYPES; }
|
|
69
69
|
});
|
|
70
70
|
Object.defineProperty(exports, "OrderQueries", {
|
|
71
71
|
enumerable: true,
|
|
72
|
-
get: function () { return
|
|
72
|
+
get: function () { return chunkHPN5R3K2_js.OrderQueries; }
|
|
73
73
|
});
|
|
74
74
|
Object.defineProperty(exports, "SchedulingService", {
|
|
75
75
|
enumerable: true,
|
|
76
|
-
get: function () { return
|
|
76
|
+
get: function () { return chunkHPN5R3K2_js.SchedulingService; }
|
|
77
77
|
});
|
|
78
78
|
Object.defineProperty(exports, "createElements", {
|
|
79
79
|
enumerable: true,
|
|
80
|
-
get: function () { return
|
|
80
|
+
get: function () { return chunkHPN5R3K2_js.createElements; }
|
|
81
81
|
});
|
|
82
82
|
Object.defineProperty(exports, "generateIdempotencyKey", {
|
|
83
83
|
enumerable: true,
|
|
84
|
-
get: function () { return
|
|
84
|
+
get: function () { return chunkHPN5R3K2_js.generateIdempotencyKey; }
|
|
85
85
|
});
|
package/dist/advanced.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthService, BusinessService, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LinkService, LiteService, MESSAGE_TYPES, OrderQueries, SchedulingService, createElements, generateIdempotencyKey } from './chunk-
|
|
1
|
+
export { AuthService, BusinessService, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LinkService, LiteService, MESSAGE_TYPES, OrderQueries, SchedulingService, createElements, generateIdempotencyKey } from './chunk-7BM56JET.mjs';
|
|
2
2
|
import './chunk-TD3AY34U.mjs';
|
|
3
3
|
import './chunk-AMZXALF6.mjs';
|
|
4
4
|
import './chunk-3G6RQLXK.mjs';
|
|
@@ -1634,6 +1634,7 @@ var CheckoutService = class {
|
|
|
1634
1634
|
customer: data.customer,
|
|
1635
1635
|
order_type: data.order_type,
|
|
1636
1636
|
address_info: data.address_info,
|
|
1637
|
+
delivery_rate_id: data.delivery_rate_id,
|
|
1637
1638
|
payment_method: data.payment_method,
|
|
1638
1639
|
mobile_money_details: data.mobile_money_details,
|
|
1639
1640
|
special_instructions: data.special_instructions,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createMockApp } from './chunk-
|
|
2
|
-
import { createCimplifyClient } from './chunk-
|
|
1
|
+
import { createMockApp } from './chunk-BRVIXGUW.mjs';
|
|
2
|
+
import { createCimplifyClient } from './chunk-NWUEWUX2.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
var cimplifyRegistry = z.registry();
|
|
@@ -2403,6 +2403,17 @@ function buildV1(deps) {
|
|
|
2403
2403
|
})
|
|
2404
2404
|
)
|
|
2405
2405
|
);
|
|
2406
|
+
app.get(
|
|
2407
|
+
"/delivery/options",
|
|
2408
|
+
(c) => tryRoute(
|
|
2409
|
+
c,
|
|
2410
|
+
() => deps.delivery.getOptions({
|
|
2411
|
+
lat: getQueryNum(c, "dropoff_lat"),
|
|
2412
|
+
lng: getQueryNum(c, "dropoff_lng"),
|
|
2413
|
+
order_value: c.req.query("order_value")
|
|
2414
|
+
})
|
|
2415
|
+
)
|
|
2416
|
+
);
|
|
2406
2417
|
app.post("/places/autocomplete", async (c) => {
|
|
2407
2418
|
const body = await c.req.json().catch(() => ({}));
|
|
2408
2419
|
return tryRoute(c, () => deps.places.autocomplete({ query: body.input ?? body.query ?? "", country: body.country }));
|
|
@@ -5313,6 +5324,22 @@ function createPlacesService() {
|
|
|
5313
5324
|
}
|
|
5314
5325
|
|
|
5315
5326
|
// src/mock/domain/delivery.ts
|
|
5327
|
+
function optionDetails(rateId, rateName) {
|
|
5328
|
+
return {
|
|
5329
|
+
zone_id: "dlvz_mock",
|
|
5330
|
+
zone_name: "Mock Zone",
|
|
5331
|
+
provider: "manual",
|
|
5332
|
+
provider_resolved_from: "zone",
|
|
5333
|
+
rate_id: rateId,
|
|
5334
|
+
rate_name: rateName,
|
|
5335
|
+
distance_km: "4.20",
|
|
5336
|
+
base_fee: money(5),
|
|
5337
|
+
per_km_fee: money(2),
|
|
5338
|
+
surge_multiplier: "1",
|
|
5339
|
+
calculated_fee: money(15),
|
|
5340
|
+
currency: "GHS"
|
|
5341
|
+
};
|
|
5342
|
+
}
|
|
5316
5343
|
function createDeliveryService() {
|
|
5317
5344
|
return {
|
|
5318
5345
|
getFee(opts) {
|
|
@@ -5329,6 +5356,39 @@ function createDeliveryService() {
|
|
|
5329
5356
|
{ provider: "uber", fee: money(22), eta_minutes: 28 }
|
|
5330
5357
|
]
|
|
5331
5358
|
};
|
|
5359
|
+
},
|
|
5360
|
+
getOptions(opts) {
|
|
5361
|
+
const orderValue = parseFloat(opts.order_value ?? "0");
|
|
5362
|
+
const standardFree = orderValue >= 200;
|
|
5363
|
+
return {
|
|
5364
|
+
serviceable: true,
|
|
5365
|
+
options: [
|
|
5366
|
+
{
|
|
5367
|
+
rate_id: "dlvrt_mock_standard",
|
|
5368
|
+
name: "Standard",
|
|
5369
|
+
fee: standardFree ? money(0) : money(15),
|
|
5370
|
+
currency: "GHS",
|
|
5371
|
+
free_delivery_applied: standardFree,
|
|
5372
|
+
free_over_amount: money(200),
|
|
5373
|
+
eta_min_minutes: 45,
|
|
5374
|
+
eta_max_minutes: 90,
|
|
5375
|
+
is_default: true,
|
|
5376
|
+
details: optionDetails("dlvrt_mock_standard", "Standard")
|
|
5377
|
+
},
|
|
5378
|
+
{
|
|
5379
|
+
rate_id: "dlvrt_mock_express",
|
|
5380
|
+
name: "Express",
|
|
5381
|
+
description: "Delivered within the hour",
|
|
5382
|
+
fee: money(25),
|
|
5383
|
+
currency: "GHS",
|
|
5384
|
+
free_delivery_applied: false,
|
|
5385
|
+
eta_min_minutes: 30,
|
|
5386
|
+
eta_max_minutes: 60,
|
|
5387
|
+
is_default: false,
|
|
5388
|
+
details: optionDetails("dlvrt_mock_express", "Express")
|
|
5389
|
+
}
|
|
5390
|
+
]
|
|
5391
|
+
};
|
|
5332
5392
|
}
|
|
5333
5393
|
};
|
|
5334
5394
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHPN5R3K2_js = require('./chunk-HPN5R3K2.js');
|
|
4
4
|
var chunkXA3ZNR75_js = require('./chunk-XA3ZNR75.js');
|
|
5
5
|
|
|
6
6
|
// src/store-credit.ts
|
|
@@ -13,7 +13,7 @@ var StoreCreditQueries = class {
|
|
|
13
13
|
* currency. Requires a signed-in customer; returns an error otherwise.
|
|
14
14
|
*/
|
|
15
15
|
async balance() {
|
|
16
|
-
return
|
|
16
|
+
return chunkHPN5R3K2_js.safe(this.client.get("/api/v1/store-credit/balance"));
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -95,7 +95,7 @@ var ActivityService = class {
|
|
|
95
95
|
this.sendEvents([event]);
|
|
96
96
|
}
|
|
97
97
|
async getState() {
|
|
98
|
-
return
|
|
98
|
+
return chunkHPN5R3K2_js.safe(this.client.get("/api/v1/activity/state"));
|
|
99
99
|
}
|
|
100
100
|
async getRecommendations(options) {
|
|
101
101
|
const params = new URLSearchParams();
|
|
@@ -103,10 +103,10 @@ var ActivityService = class {
|
|
|
103
103
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
104
104
|
const query = params.toString();
|
|
105
105
|
const path = query ? `/api/v1/activity/recommendations?${query}` : "/api/v1/activity/recommendations";
|
|
106
|
-
return
|
|
106
|
+
return chunkHPN5R3K2_js.safe(this.client.get(path));
|
|
107
107
|
}
|
|
108
108
|
async dismissMessage(code) {
|
|
109
|
-
return
|
|
109
|
+
return chunkHPN5R3K2_js.safe(
|
|
110
110
|
this.client.post("/api/v1/activity/messages/dismiss", { code })
|
|
111
111
|
);
|
|
112
112
|
}
|
|
@@ -142,16 +142,16 @@ var SubscriptionService = class {
|
|
|
142
142
|
this.client = client;
|
|
143
143
|
}
|
|
144
144
|
async list() {
|
|
145
|
-
return
|
|
145
|
+
return chunkHPN5R3K2_js.safe(this.client.get("/api/v1/subscriptions"));
|
|
146
146
|
}
|
|
147
147
|
async get(id) {
|
|
148
148
|
const encodedId = encodeURIComponent(id);
|
|
149
|
-
return
|
|
149
|
+
return chunkHPN5R3K2_js.safe(this.client.get(`/api/v1/subscriptions/${encodedId}`));
|
|
150
150
|
}
|
|
151
151
|
async cancel(id, reason, opts) {
|
|
152
152
|
const encodedId = encodeURIComponent(id);
|
|
153
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
154
|
-
return
|
|
153
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkHPN5R3K2_js.generateIdempotencyKey();
|
|
154
|
+
return chunkHPN5R3K2_js.safe(
|
|
155
155
|
this.client.post(
|
|
156
156
|
`/api/v1/subscriptions/${encodedId}/cancel`,
|
|
157
157
|
{ reason },
|
|
@@ -161,20 +161,20 @@ var SubscriptionService = class {
|
|
|
161
161
|
}
|
|
162
162
|
async pause(id) {
|
|
163
163
|
const encodedId = encodeURIComponent(id);
|
|
164
|
-
return
|
|
164
|
+
return chunkHPN5R3K2_js.safe(
|
|
165
165
|
this.client.post(`/api/v1/subscriptions/${encodedId}/pause`)
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
168
|
async resume(id) {
|
|
169
169
|
const encodedId = encodeURIComponent(id);
|
|
170
|
-
return
|
|
170
|
+
return chunkHPN5R3K2_js.safe(
|
|
171
171
|
this.client.post(`/api/v1/subscriptions/${encodedId}/resume`)
|
|
172
172
|
);
|
|
173
173
|
}
|
|
174
174
|
async skipNextRenewal(id, opts) {
|
|
175
175
|
const encodedId = encodeURIComponent(id);
|
|
176
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
177
|
-
return
|
|
176
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkHPN5R3K2_js.generateIdempotencyKey();
|
|
177
|
+
return chunkHPN5R3K2_js.safe(
|
|
178
178
|
this.client.post(
|
|
179
179
|
`/api/v1/subscriptions/${encodedId}/skip`,
|
|
180
180
|
void 0,
|
|
@@ -190,8 +190,8 @@ var UploadService = class {
|
|
|
190
190
|
this.client = client;
|
|
191
191
|
}
|
|
192
192
|
async init(filename, contentType, sizeBytes, opts) {
|
|
193
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
194
|
-
return
|
|
193
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkHPN5R3K2_js.generateIdempotencyKey();
|
|
194
|
+
return chunkHPN5R3K2_js.safe(
|
|
195
195
|
this.client.post(
|
|
196
196
|
"/api/v1/uploads/init",
|
|
197
197
|
{
|
|
@@ -204,7 +204,7 @@ var UploadService = class {
|
|
|
204
204
|
);
|
|
205
205
|
}
|
|
206
206
|
async confirm(uploadId) {
|
|
207
|
-
return
|
|
207
|
+
return chunkHPN5R3K2_js.safe(
|
|
208
208
|
this.client.post("/api/v1/uploads/confirm", {
|
|
209
209
|
upload_id: uploadId
|
|
210
210
|
})
|
|
@@ -250,7 +250,7 @@ var PlacesService = class {
|
|
|
250
250
|
this.client = client;
|
|
251
251
|
}
|
|
252
252
|
async autocomplete(input, sessionToken) {
|
|
253
|
-
return
|
|
253
|
+
return chunkHPN5R3K2_js.safe(
|
|
254
254
|
this.client.post("/api/v1/places/autocomplete", {
|
|
255
255
|
input,
|
|
256
256
|
sessionToken
|
|
@@ -258,7 +258,7 @@ var PlacesService = class {
|
|
|
258
258
|
);
|
|
259
259
|
}
|
|
260
260
|
async details(placeId, sessionToken) {
|
|
261
|
-
return
|
|
261
|
+
return chunkHPN5R3K2_js.safe(
|
|
262
262
|
this.client.post("/api/v1/places/details", {
|
|
263
263
|
place_id: placeId,
|
|
264
264
|
sessionToken
|
|
@@ -277,10 +277,22 @@ var DeliveryService = class {
|
|
|
277
277
|
params.set("dropoff_lat", String(dropoffLat));
|
|
278
278
|
params.set("dropoff_lng", String(dropoffLng));
|
|
279
279
|
if (country) params.set("country", country);
|
|
280
|
-
return
|
|
280
|
+
return chunkHPN5R3K2_js.safe(
|
|
281
281
|
this.client.get(`/api/v1/delivery/fee?${params.toString()}`)
|
|
282
282
|
);
|
|
283
283
|
}
|
|
284
|
+
/** The full delivery menu for an address. Pass the selected option's
|
|
285
|
+
* `rate_id` as `delivery_rate_id` when processing checkout. */
|
|
286
|
+
async getOptions(dropoffLat, dropoffLng, opts) {
|
|
287
|
+
const params = new URLSearchParams();
|
|
288
|
+
params.set("dropoff_lat", String(dropoffLat));
|
|
289
|
+
params.set("dropoff_lng", String(dropoffLng));
|
|
290
|
+
if (opts?.country) params.set("country", opts.country);
|
|
291
|
+
if (opts?.orderValue != null) params.set("order_value", String(opts.orderValue));
|
|
292
|
+
return chunkHPN5R3K2_js.safe(
|
|
293
|
+
this.client.get(`/api/v1/delivery/options?${params.toString()}`)
|
|
294
|
+
);
|
|
295
|
+
}
|
|
284
296
|
};
|
|
285
297
|
|
|
286
298
|
// src/support.ts
|
|
@@ -290,8 +302,8 @@ var SupportService = class {
|
|
|
290
302
|
}
|
|
291
303
|
/** Open (or resume) the customer's widget conversation. */
|
|
292
304
|
async openConversation(opts) {
|
|
293
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
294
|
-
return
|
|
305
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkHPN5R3K2_js.generateIdempotencyKey();
|
|
306
|
+
return chunkHPN5R3K2_js.safe(
|
|
295
307
|
this.client.post("/api/v1/support/conversation", void 0, {
|
|
296
308
|
idempotencyKey
|
|
297
309
|
})
|
|
@@ -299,8 +311,8 @@ var SupportService = class {
|
|
|
299
311
|
}
|
|
300
312
|
/** Send a message in the active conversation. */
|
|
301
313
|
async sendMessage(content, opts) {
|
|
302
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
303
|
-
return
|
|
314
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkHPN5R3K2_js.generateIdempotencyKey();
|
|
315
|
+
return chunkHPN5R3K2_js.safe(
|
|
304
316
|
this.client.post(
|
|
305
317
|
"/api/v1/support/conversation/messages",
|
|
306
318
|
{ content },
|
|
@@ -315,7 +327,7 @@ var SupportService = class {
|
|
|
315
327
|
if (options.limit) params.set("limit", String(options.limit));
|
|
316
328
|
const query = params.toString();
|
|
317
329
|
const path = query ? `/api/v1/support/conversation/messages?${query}` : "/api/v1/support/conversation/messages";
|
|
318
|
-
return
|
|
330
|
+
return chunkHPN5R3K2_js.safe(this.client.get(path));
|
|
319
331
|
}
|
|
320
332
|
};
|
|
321
333
|
|
|
@@ -501,6 +513,15 @@ var CimplifyClient = class {
|
|
|
501
513
|
getPublicKey() {
|
|
502
514
|
return this.publicKey;
|
|
503
515
|
}
|
|
516
|
+
getBaseUrl() {
|
|
517
|
+
return this.baseUrl;
|
|
518
|
+
}
|
|
519
|
+
getLinkApiUrl() {
|
|
520
|
+
return this.linkApiUrl;
|
|
521
|
+
}
|
|
522
|
+
getCredentialsMode() {
|
|
523
|
+
return this.credentials;
|
|
524
|
+
}
|
|
504
525
|
isTestMode() {
|
|
505
526
|
return this.publicKey.trim().startsWith("cpk_test_");
|
|
506
527
|
}
|
|
@@ -901,25 +922,25 @@ var CimplifyClient = class {
|
|
|
901
922
|
}
|
|
902
923
|
get catalogue() {
|
|
903
924
|
if (!this._catalogue) {
|
|
904
|
-
this._catalogue = new
|
|
925
|
+
this._catalogue = new chunkHPN5R3K2_js.CatalogueQueries(this);
|
|
905
926
|
}
|
|
906
927
|
return this._catalogue;
|
|
907
928
|
}
|
|
908
929
|
get cart() {
|
|
909
930
|
if (!this._cart) {
|
|
910
|
-
this._cart = new
|
|
931
|
+
this._cart = new chunkHPN5R3K2_js.CartOperations(this);
|
|
911
932
|
}
|
|
912
933
|
return this._cart;
|
|
913
934
|
}
|
|
914
935
|
get checkout() {
|
|
915
936
|
if (!this._checkout) {
|
|
916
|
-
this._checkout = new
|
|
937
|
+
this._checkout = new chunkHPN5R3K2_js.CheckoutService(this);
|
|
917
938
|
}
|
|
918
939
|
return this._checkout;
|
|
919
940
|
}
|
|
920
941
|
get orders() {
|
|
921
942
|
if (!this._orders) {
|
|
922
|
-
this._orders = new
|
|
943
|
+
this._orders = new chunkHPN5R3K2_js.OrderQueries(this);
|
|
923
944
|
}
|
|
924
945
|
return this._orders;
|
|
925
946
|
}
|
|
@@ -949,43 +970,43 @@ var CimplifyClient = class {
|
|
|
949
970
|
}
|
|
950
971
|
get link() {
|
|
951
972
|
if (!this._link) {
|
|
952
|
-
this._link = new
|
|
973
|
+
this._link = new chunkHPN5R3K2_js.LinkService(this);
|
|
953
974
|
}
|
|
954
975
|
return this._link;
|
|
955
976
|
}
|
|
956
977
|
get auth() {
|
|
957
978
|
if (!this._auth) {
|
|
958
|
-
this._auth = new
|
|
979
|
+
this._auth = new chunkHPN5R3K2_js.AuthService(this);
|
|
959
980
|
}
|
|
960
981
|
return this._auth;
|
|
961
982
|
}
|
|
962
983
|
get business() {
|
|
963
984
|
if (!this._business) {
|
|
964
|
-
this._business = new
|
|
985
|
+
this._business = new chunkHPN5R3K2_js.BusinessService(this);
|
|
965
986
|
}
|
|
966
987
|
return this._business;
|
|
967
988
|
}
|
|
968
989
|
get inventory() {
|
|
969
990
|
if (!this._inventory) {
|
|
970
|
-
this._inventory = new
|
|
991
|
+
this._inventory = new chunkHPN5R3K2_js.InventoryService(this);
|
|
971
992
|
}
|
|
972
993
|
return this._inventory;
|
|
973
994
|
}
|
|
974
995
|
get scheduling() {
|
|
975
996
|
if (!this._scheduling) {
|
|
976
|
-
this._scheduling = new
|
|
997
|
+
this._scheduling = new chunkHPN5R3K2_js.SchedulingService(this);
|
|
977
998
|
}
|
|
978
999
|
return this._scheduling;
|
|
979
1000
|
}
|
|
980
1001
|
get lite() {
|
|
981
1002
|
if (!this._lite) {
|
|
982
|
-
this._lite = new
|
|
1003
|
+
this._lite = new chunkHPN5R3K2_js.LiteService(this);
|
|
983
1004
|
}
|
|
984
1005
|
return this._lite;
|
|
985
1006
|
}
|
|
986
1007
|
get fx() {
|
|
987
1008
|
if (!this._fx) {
|
|
988
|
-
this._fx = new
|
|
1009
|
+
this._fx = new chunkHPN5R3K2_js.FxService(this);
|
|
989
1010
|
}
|
|
990
1011
|
return this._fx;
|
|
991
1012
|
}
|
|
@@ -1020,7 +1041,7 @@ var CimplifyClient = class {
|
|
|
1020
1041
|
if (businessId) {
|
|
1021
1042
|
this.setBusinessId(businessId);
|
|
1022
1043
|
}
|
|
1023
|
-
return
|
|
1044
|
+
return chunkHPN5R3K2_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
|
|
1024
1045
|
}
|
|
1025
1046
|
};
|
|
1026
1047
|
function createCimplifyClient(config = {}) {
|
|
@@ -1636,6 +1636,7 @@ var CheckoutService = class {
|
|
|
1636
1636
|
customer: data.customer,
|
|
1637
1637
|
order_type: data.order_type,
|
|
1638
1638
|
address_info: data.address_info,
|
|
1639
|
+
delivery_rate_id: data.delivery_rate_id,
|
|
1639
1640
|
payment_method: data.payment_method,
|
|
1640
1641
|
mobile_money_details: data.mobile_money_details,
|
|
1641
1642
|
special_instructions: data.special_instructions,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkSRJEMEVZ_js = require('./chunk-SRJEMEVZ.js');
|
|
4
|
+
var chunkGFM5JW45_js = require('./chunk-GFM5JW45.js');
|
|
5
5
|
var zod = require('zod');
|
|
6
6
|
|
|
7
7
|
var cimplifyRegistry = zod.z.registry();
|
|
@@ -598,7 +598,7 @@ async function toForwardedRequest(input, init) {
|
|
|
598
598
|
};
|
|
599
599
|
}
|
|
600
600
|
function createTestClient(options = {}) {
|
|
601
|
-
const mock =
|
|
601
|
+
const mock = chunkSRJEMEVZ_js.createMockApp(options);
|
|
602
602
|
let sessionToken;
|
|
603
603
|
const fetchImpl = async (input, init) => {
|
|
604
604
|
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
@@ -617,7 +617,7 @@ function createTestClient(options = {}) {
|
|
|
617
617
|
if (echoed) sessionToken = echoed;
|
|
618
618
|
return res;
|
|
619
619
|
};
|
|
620
|
-
const client =
|
|
620
|
+
const client = chunkGFM5JW45_js.createCimplifyClient({
|
|
621
621
|
baseUrl: TEST_BASE_URL,
|
|
622
622
|
// Link mock lives at /v1/link on the same Hono app, so point the SDK's
|
|
623
623
|
// separate Link transport at the same TEST_BASE_URL.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { safe, generateIdempotencyKey, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-
|
|
1
|
+
import { safe, generateIdempotencyKey, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-7BM56JET.mjs';
|
|
2
2
|
import { CimplifyError, ErrorCode, IdempotencyMismatchError, enrichError } from './chunk-AMZXALF6.mjs';
|
|
3
3
|
|
|
4
4
|
// src/store-credit.ts
|
|
@@ -279,6 +279,18 @@ var DeliveryService = class {
|
|
|
279
279
|
this.client.get(`/api/v1/delivery/fee?${params.toString()}`)
|
|
280
280
|
);
|
|
281
281
|
}
|
|
282
|
+
/** The full delivery menu for an address. Pass the selected option's
|
|
283
|
+
* `rate_id` as `delivery_rate_id` when processing checkout. */
|
|
284
|
+
async getOptions(dropoffLat, dropoffLng, opts) {
|
|
285
|
+
const params = new URLSearchParams();
|
|
286
|
+
params.set("dropoff_lat", String(dropoffLat));
|
|
287
|
+
params.set("dropoff_lng", String(dropoffLng));
|
|
288
|
+
if (opts?.country) params.set("country", opts.country);
|
|
289
|
+
if (opts?.orderValue != null) params.set("order_value", String(opts.orderValue));
|
|
290
|
+
return safe(
|
|
291
|
+
this.client.get(`/api/v1/delivery/options?${params.toString()}`)
|
|
292
|
+
);
|
|
293
|
+
}
|
|
282
294
|
};
|
|
283
295
|
|
|
284
296
|
// src/support.ts
|
|
@@ -499,6 +511,15 @@ var CimplifyClient = class {
|
|
|
499
511
|
getPublicKey() {
|
|
500
512
|
return this.publicKey;
|
|
501
513
|
}
|
|
514
|
+
getBaseUrl() {
|
|
515
|
+
return this.baseUrl;
|
|
516
|
+
}
|
|
517
|
+
getLinkApiUrl() {
|
|
518
|
+
return this.linkApiUrl;
|
|
519
|
+
}
|
|
520
|
+
getCredentialsMode() {
|
|
521
|
+
return this.credentials;
|
|
522
|
+
}
|
|
502
523
|
isTestMode() {
|
|
503
524
|
return this.publicKey.trim().startsWith("cpk_test_");
|
|
504
525
|
}
|
|
@@ -2405,6 +2405,17 @@ function buildV1(deps) {
|
|
|
2405
2405
|
})
|
|
2406
2406
|
)
|
|
2407
2407
|
);
|
|
2408
|
+
app.get(
|
|
2409
|
+
"/delivery/options",
|
|
2410
|
+
(c) => tryRoute(
|
|
2411
|
+
c,
|
|
2412
|
+
() => deps.delivery.getOptions({
|
|
2413
|
+
lat: getQueryNum(c, "dropoff_lat"),
|
|
2414
|
+
lng: getQueryNum(c, "dropoff_lng"),
|
|
2415
|
+
order_value: c.req.query("order_value")
|
|
2416
|
+
})
|
|
2417
|
+
)
|
|
2418
|
+
);
|
|
2408
2419
|
app.post("/places/autocomplete", async (c) => {
|
|
2409
2420
|
const body = await c.req.json().catch(() => ({}));
|
|
2410
2421
|
return tryRoute(c, () => deps.places.autocomplete({ query: body.input ?? body.query ?? "", country: body.country }));
|
|
@@ -5315,6 +5326,22 @@ function createPlacesService() {
|
|
|
5315
5326
|
}
|
|
5316
5327
|
|
|
5317
5328
|
// src/mock/domain/delivery.ts
|
|
5329
|
+
function optionDetails(rateId, rateName) {
|
|
5330
|
+
return {
|
|
5331
|
+
zone_id: "dlvz_mock",
|
|
5332
|
+
zone_name: "Mock Zone",
|
|
5333
|
+
provider: "manual",
|
|
5334
|
+
provider_resolved_from: "zone",
|
|
5335
|
+
rate_id: rateId,
|
|
5336
|
+
rate_name: rateName,
|
|
5337
|
+
distance_km: "4.20",
|
|
5338
|
+
base_fee: money(5),
|
|
5339
|
+
per_km_fee: money(2),
|
|
5340
|
+
surge_multiplier: "1",
|
|
5341
|
+
calculated_fee: money(15),
|
|
5342
|
+
currency: "GHS"
|
|
5343
|
+
};
|
|
5344
|
+
}
|
|
5318
5345
|
function createDeliveryService() {
|
|
5319
5346
|
return {
|
|
5320
5347
|
getFee(opts) {
|
|
@@ -5331,6 +5358,39 @@ function createDeliveryService() {
|
|
|
5331
5358
|
{ provider: "uber", fee: money(22), eta_minutes: 28 }
|
|
5332
5359
|
]
|
|
5333
5360
|
};
|
|
5361
|
+
},
|
|
5362
|
+
getOptions(opts) {
|
|
5363
|
+
const orderValue = parseFloat(opts.order_value ?? "0");
|
|
5364
|
+
const standardFree = orderValue >= 200;
|
|
5365
|
+
return {
|
|
5366
|
+
serviceable: true,
|
|
5367
|
+
options: [
|
|
5368
|
+
{
|
|
5369
|
+
rate_id: "dlvrt_mock_standard",
|
|
5370
|
+
name: "Standard",
|
|
5371
|
+
fee: standardFree ? money(0) : money(15),
|
|
5372
|
+
currency: "GHS",
|
|
5373
|
+
free_delivery_applied: standardFree,
|
|
5374
|
+
free_over_amount: money(200),
|
|
5375
|
+
eta_min_minutes: 45,
|
|
5376
|
+
eta_max_minutes: 90,
|
|
5377
|
+
is_default: true,
|
|
5378
|
+
details: optionDetails("dlvrt_mock_standard", "Standard")
|
|
5379
|
+
},
|
|
5380
|
+
{
|
|
5381
|
+
rate_id: "dlvrt_mock_express",
|
|
5382
|
+
name: "Express",
|
|
5383
|
+
description: "Delivered within the hour",
|
|
5384
|
+
fee: money(25),
|
|
5385
|
+
currency: "GHS",
|
|
5386
|
+
free_delivery_applied: false,
|
|
5387
|
+
eta_min_minutes: 30,
|
|
5388
|
+
eta_max_minutes: 60,
|
|
5389
|
+
is_default: false,
|
|
5390
|
+
details: optionDetails("dlvrt_mock_express", "Express")
|
|
5391
|
+
}
|
|
5392
|
+
]
|
|
5393
|
+
};
|
|
5334
5394
|
}
|
|
5335
5395
|
};
|
|
5336
5396
|
}
|