@cimplify/sdk 0.100.3 → 0.100.4
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/README.md +17 -0
- 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-FWKSBF3F.js → chunk-3HU5I5VG.js} +20 -4
- package/dist/{chunk-NOGCGI4J.mjs → chunk-HSDQWJLA.mjs} +2 -2
- package/dist/{chunk-CNY2XFN4.js → chunk-JEVCHTKZ.js} +48 -47
- package/dist/{chunk-KNCW5DI7.js → chunk-LMD7B33E.js} +4 -4
- package/dist/{chunk-XCS56XSS.js → chunk-PNTINRAU.js} +31 -1
- package/dist/{chunk-HFTRLRLM.mjs → chunk-RQPXLXB2.mjs} +31 -1
- package/dist/{chunk-XG4DZT4I.mjs → chunk-RWR7JF7F.mjs} +2 -1
- package/dist/{chunk-FFRQNNUQ.mjs → chunk-Z7M6GAHS.mjs} +20 -4
- package/dist/{client-Bx4NRdl8.d.mts → client-BwRAAk4y.d.mts} +15 -0
- package/dist/{client-Cvp8W1r9.d.ts → client-CPcZIrjC.d.ts} +2 -2
- package/dist/{client-BWdeCgmo.d.ts → client-CrPglBBz.d.ts} +15 -0
- package/dist/{client-BGeSemVv.d.mts → client-DGrvLiJv.d.mts} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +69 -69
- package/dist/index.mjs +3 -3
- package/dist/lint-rules.json +1 -0
- package/dist/lint.d.mts +537 -0
- package/dist/lint.d.ts +537 -0
- package/dist/lint.js +540 -0
- package/dist/lint.mjs +524 -0
- package/dist/mock/cli.mjs +31 -1
- package/dist/mock/library.js +31 -1
- package/dist/mock/library.mjs +31 -1
- package/dist/mock/msw.js +31 -1
- package/dist/mock/msw.mjs +31 -1
- package/dist/react.d.mts +10 -5
- package/dist/react.d.ts +10 -5
- package/dist/react.js +40 -35
- package/dist/react.mjs +14 -9
- package/dist/{server-BRJ61o2J.d.mts → server-DRAW2OOX.d.mts} +4 -1
- package/dist/{server-CXrVYtNo.d.ts → server-zyrpzJVn.d.ts} +4 -1
- 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/styles.css +1 -1
- 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 +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +79 -79
- package/dist/testing.mjs +5 -5
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -29,12 +29,29 @@ yarn add @cimplify/sdk
|
|
|
29
29
|
| `@cimplify/sdk/server` | Server Components / Server Actions: `getServerClient()`, `tags.*`, `revalidate*` |
|
|
30
30
|
| `@cimplify/sdk/utils` | Money helpers, formatting, slug helpers |
|
|
31
31
|
| `@cimplify/sdk/advanced` | Lower-level escape hatches |
|
|
32
|
+
| `@cimplify/sdk/lint` | Declarative lint authoring types + the bundled starter rule set |
|
|
33
|
+
| `@cimplify/sdk/lint-rules` | Static, version-matched JSON rules consumed by `cimplify lint` |
|
|
32
34
|
| `@cimplify/sdk/mock` | Programmatic mock for tests / MSW |
|
|
33
35
|
| `@cimplify/sdk/mock/msw` | MSW handlers wrapping the in-process mock |
|
|
34
36
|
| `@cimplify/sdk/testing` | Test harness — zod schemas, `createTestClient`, fixtures, `assertX` helpers |
|
|
35
37
|
| `@cimplify/sdk/testing/suite` | Pre-baked vitest suites: `createBrandSuite`, `createCartFlowSuite`, `createContractSuite` |
|
|
36
38
|
| `@cimplify/sdk/styles.css` | Pre-compiled Tailwind utilities for the React components |
|
|
37
39
|
|
|
40
|
+
`@cimplify/sdk/lint` is intentionally parser-free: it exports serializable rule declarations and six reusable matching primitives. The runner owns AST parsing and reads the installed SDK's `lint-rules` JSON as bounded, validated data—project JavaScript is never loaded by a lint pass. Older SDKs fall back to the trusted rule set bundled with the CLI.
|
|
41
|
+
|
|
42
|
+
### SDK correctness rules
|
|
43
|
+
|
|
44
|
+
Rules are declarations, not AST visitors. The v1 vocabulary is:
|
|
45
|
+
|
|
46
|
+
- `banned-import`
|
|
47
|
+
- `banned-jsx-element`
|
|
48
|
+
- `banned-call-argument`
|
|
49
|
+
- `banned-classname-pattern`
|
|
50
|
+
- `required-result-check`
|
|
51
|
+
- `required-wrapper-call`
|
|
52
|
+
|
|
53
|
+
Add a rule with `defineLintRule(...)`, include it in `starterLintRuleSet`, and add one clean plus one violating fixture under the CLI's `src/lint/__fixtures__` directory. The fixture test runs every rule independently, so a new declaration cannot silently rely on another rule's diagnostic. Flow-sensitive rules that do not fit these primitives belong in a later semantic pass rather than a one-off walker.
|
|
54
|
+
|
|
38
55
|
## Mock storefront API
|
|
39
56
|
|
|
40
57
|
This package ships an embeddable mock storefront API used by tests and local dev:
|
package/dist/advanced.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements, aL as ELEMENT_TYPES, aM as EVENT_TYPES, aP as ElementEventType, aQ as ElementOptions, aR as ElementType, aZ as ElementsOptions, b5 as FetchQuoteInput, be as FxService, bi as GetProductsOptions, bl as InventoryService, bt as LinkService, bz as LiteService, bG as MESSAGE_TYPES, c6 as OrderQueries, cs as PriceQuote, cy as QuoteBundleSelectionInput, cz as QuoteCompositeSelectionInput, cA as QuoteDynamicBuckets, cB as QuoteStatus, cC as QuoteUiMessage, cE as RefreshQuoteInput, cF as RefreshQuoteResult, d5 as SchedulingService, dL as createElements } from './client-
|
|
1
|
+
export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements, aL as ELEMENT_TYPES, aM as EVENT_TYPES, aP as ElementEventType, aQ as ElementOptions, aR as ElementType, aZ as ElementsOptions, b5 as FetchQuoteInput, be as FxService, bi as GetProductsOptions, bl as InventoryService, bt as LinkService, bz as LiteService, bG as MESSAGE_TYPES, c6 as OrderQueries, cs as PriceQuote, cy as QuoteBundleSelectionInput, cz as QuoteCompositeSelectionInput, cA as QuoteDynamicBuckets, cB as QuoteStatus, cC as QuoteUiMessage, cE as RefreshQuoteInput, cF as RefreshQuoteResult, d5 as SchedulingService, dL as createElements } from './client-BwRAAk4y.mjs';
|
|
2
2
|
import './product-CeV8euw4.mjs';
|
|
3
3
|
import './payment-BSzy7sly.mjs';
|
|
4
4
|
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements, aL as ELEMENT_TYPES, aM as EVENT_TYPES, aP as ElementEventType, aQ as ElementOptions, aR as ElementType, aZ as ElementsOptions, b5 as FetchQuoteInput, be as FxService, bi as GetProductsOptions, bl as InventoryService, bt as LinkService, bz as LiteService, bG as MESSAGE_TYPES, c6 as OrderQueries, cs as PriceQuote, cy as QuoteBundleSelectionInput, cz as QuoteCompositeSelectionInput, cA as QuoteDynamicBuckets, cB as QuoteStatus, cC as QuoteUiMessage, cE as RefreshQuoteInput, cF as RefreshQuoteResult, d5 as SchedulingService, dL as createElements } from './client-
|
|
1
|
+
export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements, aL as ELEMENT_TYPES, aM as EVENT_TYPES, aP as ElementEventType, aQ as ElementOptions, aR as ElementType, aZ as ElementsOptions, b5 as FetchQuoteInput, be as FxService, bi as GetProductsOptions, bl as InventoryService, bt as LinkService, bz as LiteService, bG as MESSAGE_TYPES, c6 as OrderQueries, cs as PriceQuote, cy as QuoteBundleSelectionInput, cz as QuoteCompositeSelectionInput, cA as QuoteDynamicBuckets, cB as QuoteStatus, cC as QuoteUiMessage, cE as RefreshQuoteInput, cF as RefreshQuoteResult, d5 as SchedulingService, dL as createElements } from './client-CrPglBBz.js';
|
|
2
2
|
import './product-CeV8euw4.js';
|
|
3
3
|
import './payment-jK8ztICx.js';
|
|
4
4
|
|
package/dist/advanced.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk3HU5I5VG_js = require('./chunk-3HU5I5VG.js');
|
|
4
4
|
require('./chunk-WMEC5JWN.js');
|
|
5
5
|
require('./chunk-NIOUSKQQ.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 chunk3HU5I5VG_js.AuthService; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "BusinessService", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunk3HU5I5VG_js.BusinessService; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "CartOperations", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunk3HU5I5VG_js.CartOperations; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "CatalogueQueries", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunk3HU5I5VG_js.CatalogueQueries; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "CheckoutOperations", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunk3HU5I5VG_js.CheckoutService; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "CheckoutService", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunk3HU5I5VG_js.CheckoutService; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "CimplifyElement", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunk3HU5I5VG_js.CimplifyElement; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "CimplifyElements", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunk3HU5I5VG_js.CimplifyElements; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "ELEMENT_TYPES", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunk3HU5I5VG_js.ELEMENT_TYPES; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "EVENT_TYPES", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunk3HU5I5VG_js.EVENT_TYPES; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "FxService", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunk3HU5I5VG_js.FxService; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "InventoryService", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunk3HU5I5VG_js.InventoryService; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "LinkService", {
|
|
59
59
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunk3HU5I5VG_js.LinkService; }
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "LiteService", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunk3HU5I5VG_js.LiteService; }
|
|
65
65
|
});
|
|
66
66
|
Object.defineProperty(exports, "MESSAGE_TYPES", {
|
|
67
67
|
enumerable: true,
|
|
68
|
-
get: function () { return
|
|
68
|
+
get: function () { return chunk3HU5I5VG_js.MESSAGE_TYPES; }
|
|
69
69
|
});
|
|
70
70
|
Object.defineProperty(exports, "OrderQueries", {
|
|
71
71
|
enumerable: true,
|
|
72
|
-
get: function () { return
|
|
72
|
+
get: function () { return chunk3HU5I5VG_js.OrderQueries; }
|
|
73
73
|
});
|
|
74
74
|
Object.defineProperty(exports, "SchedulingService", {
|
|
75
75
|
enumerable: true,
|
|
76
|
-
get: function () { return
|
|
76
|
+
get: function () { return chunk3HU5I5VG_js.SchedulingService; }
|
|
77
77
|
});
|
|
78
78
|
Object.defineProperty(exports, "createElements", {
|
|
79
79
|
enumerable: true,
|
|
80
|
-
get: function () { return
|
|
80
|
+
get: function () { return chunk3HU5I5VG_js.createElements; }
|
|
81
81
|
});
|
|
82
82
|
Object.defineProperty(exports, "generateIdempotencyKey", {
|
|
83
83
|
enumerable: true,
|
|
84
|
-
get: function () { return
|
|
84
|
+
get: function () { return chunk3HU5I5VG_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-Z7M6GAHS.mjs';
|
|
2
2
|
import './chunk-DLW3RWRK.mjs';
|
|
3
3
|
import './chunk-O3YUHLZL.mjs';
|
|
4
4
|
import './chunk-3G6RQLXK.mjs';
|
|
@@ -1219,9 +1219,17 @@ var CheckoutResolver = class {
|
|
|
1219
1219
|
);
|
|
1220
1220
|
}
|
|
1221
1221
|
if (popupError === "PROVIDER_UNAVAILABLE") {
|
|
1222
|
-
return this.fail(
|
|
1222
|
+
return this.fail(
|
|
1223
|
+
"PROVIDER_UNAVAILABLE",
|
|
1224
|
+
"Card payment provider is unavailable.",
|
|
1225
|
+
false
|
|
1226
|
+
);
|
|
1223
1227
|
}
|
|
1224
|
-
return this.fail(
|
|
1228
|
+
return this.fail(
|
|
1229
|
+
"PAYMENT_CANCELLED",
|
|
1230
|
+
"Card payment was cancelled before completion.",
|
|
1231
|
+
true
|
|
1232
|
+
);
|
|
1225
1233
|
}
|
|
1226
1234
|
paymentReference = popupResult.reference || paymentReference;
|
|
1227
1235
|
break;
|
|
@@ -1229,7 +1237,11 @@ var CheckoutResolver = class {
|
|
|
1229
1237
|
case NEXT_ACTION_REDIRECT: {
|
|
1230
1238
|
if (typeof window !== "undefined" && this.returnUrl) {
|
|
1231
1239
|
window.location.assign(action.authorization_url);
|
|
1232
|
-
return this.fail(
|
|
1240
|
+
return this.fail(
|
|
1241
|
+
"REDIRECT_REQUIRED",
|
|
1242
|
+
"Redirecting to complete payment authorization.",
|
|
1243
|
+
true
|
|
1244
|
+
);
|
|
1233
1245
|
}
|
|
1234
1246
|
if (typeof window !== "undefined") {
|
|
1235
1247
|
const popup = window.open(
|
|
@@ -1486,8 +1498,12 @@ var CheckoutResolver = class {
|
|
|
1486
1498
|
apartment: source.apartment || void 0,
|
|
1487
1499
|
city: source.city || "",
|
|
1488
1500
|
region: source.region || "",
|
|
1501
|
+
postal_code: source.postal_code || void 0,
|
|
1502
|
+
country: source.country || void 0,
|
|
1489
1503
|
delivery_instructions: source.delivery_instructions || void 0,
|
|
1490
|
-
phone_for_delivery: source.phone_for_delivery || void 0
|
|
1504
|
+
phone_for_delivery: source.phone_for_delivery || void 0,
|
|
1505
|
+
latitude: source.latitude,
|
|
1506
|
+
longitude: source.longitude
|
|
1491
1507
|
};
|
|
1492
1508
|
}
|
|
1493
1509
|
getEnrollmentMobileMoney() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createMockApp } from './chunk-
|
|
2
|
-
import { createCimplifyClient } from './chunk-
|
|
1
|
+
import { createMockApp } from './chunk-RQPXLXB2.mjs';
|
|
2
|
+
import { createCimplifyClient } from './chunk-RWR7JF7F.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
var cimplifyRegistry = z.registry();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk3HU5I5VG_js = require('./chunk-3HU5I5VG.js');
|
|
4
4
|
var chunkNIOUSKQQ_js = require('./chunk-NIOUSKQQ.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 chunk3HU5I5VG_js.safe(this.client.get("/api/v1/store-credit/balance"));
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -262,7 +262,7 @@ var ActivityService = class {
|
|
|
262
262
|
this.sendEvents([event]);
|
|
263
263
|
}
|
|
264
264
|
async getState() {
|
|
265
|
-
return
|
|
265
|
+
return chunk3HU5I5VG_js.safe(this.client.get("/api/v1/activity/state"));
|
|
266
266
|
}
|
|
267
267
|
async getRecommendations(options) {
|
|
268
268
|
const params = new URLSearchParams();
|
|
@@ -270,10 +270,10 @@ var ActivityService = class {
|
|
|
270
270
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
271
271
|
const query = params.toString();
|
|
272
272
|
const path = query ? `/api/v1/activity/recommendations?${query}` : "/api/v1/activity/recommendations";
|
|
273
|
-
return
|
|
273
|
+
return chunk3HU5I5VG_js.safe(this.client.get(path));
|
|
274
274
|
}
|
|
275
275
|
async dismissMessage(code) {
|
|
276
|
-
return
|
|
276
|
+
return chunk3HU5I5VG_js.safe(
|
|
277
277
|
this.client.post("/api/v1/activity/messages/dismiss", { code })
|
|
278
278
|
);
|
|
279
279
|
}
|
|
@@ -369,16 +369,16 @@ var SubscriptionService = class {
|
|
|
369
369
|
this.client = client;
|
|
370
370
|
}
|
|
371
371
|
async list() {
|
|
372
|
-
return
|
|
372
|
+
return chunk3HU5I5VG_js.safe(this.client.get("/api/v1/subscriptions"));
|
|
373
373
|
}
|
|
374
374
|
async get(id) {
|
|
375
375
|
const encodedId = encodeURIComponent(id);
|
|
376
|
-
return
|
|
376
|
+
return chunk3HU5I5VG_js.safe(this.client.get(`/api/v1/subscriptions/${encodedId}`));
|
|
377
377
|
}
|
|
378
378
|
async cancel(id, reason, opts) {
|
|
379
379
|
const encodedId = encodeURIComponent(id);
|
|
380
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
381
|
-
return
|
|
380
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunk3HU5I5VG_js.generateIdempotencyKey();
|
|
381
|
+
return chunk3HU5I5VG_js.safe(
|
|
382
382
|
this.client.post(
|
|
383
383
|
`/api/v1/subscriptions/${encodedId}/cancel`,
|
|
384
384
|
{ reason },
|
|
@@ -388,20 +388,20 @@ var SubscriptionService = class {
|
|
|
388
388
|
}
|
|
389
389
|
async pause(id) {
|
|
390
390
|
const encodedId = encodeURIComponent(id);
|
|
391
|
-
return
|
|
391
|
+
return chunk3HU5I5VG_js.safe(
|
|
392
392
|
this.client.post(`/api/v1/subscriptions/${encodedId}/pause`)
|
|
393
393
|
);
|
|
394
394
|
}
|
|
395
395
|
async resume(id) {
|
|
396
396
|
const encodedId = encodeURIComponent(id);
|
|
397
|
-
return
|
|
397
|
+
return chunk3HU5I5VG_js.safe(
|
|
398
398
|
this.client.post(`/api/v1/subscriptions/${encodedId}/resume`)
|
|
399
399
|
);
|
|
400
400
|
}
|
|
401
401
|
async skipNextRenewal(id, opts) {
|
|
402
402
|
const encodedId = encodeURIComponent(id);
|
|
403
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
404
|
-
return
|
|
403
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunk3HU5I5VG_js.generateIdempotencyKey();
|
|
404
|
+
return chunk3HU5I5VG_js.safe(
|
|
405
405
|
this.client.post(
|
|
406
406
|
`/api/v1/subscriptions/${encodedId}/skip`,
|
|
407
407
|
void 0,
|
|
@@ -417,8 +417,8 @@ var UploadService = class {
|
|
|
417
417
|
this.client = client;
|
|
418
418
|
}
|
|
419
419
|
async init(filename, contentType, sizeBytes, opts) {
|
|
420
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
421
|
-
return
|
|
420
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunk3HU5I5VG_js.generateIdempotencyKey();
|
|
421
|
+
return chunk3HU5I5VG_js.safe(
|
|
422
422
|
this.client.post(
|
|
423
423
|
"/api/v1/uploads/init",
|
|
424
424
|
{
|
|
@@ -431,7 +431,7 @@ var UploadService = class {
|
|
|
431
431
|
);
|
|
432
432
|
}
|
|
433
433
|
async confirm(uploadId) {
|
|
434
|
-
return
|
|
434
|
+
return chunk3HU5I5VG_js.safe(
|
|
435
435
|
this.client.post("/api/v1/uploads/confirm", {
|
|
436
436
|
upload_id: uploadId
|
|
437
437
|
})
|
|
@@ -477,7 +477,7 @@ var PlacesService = class {
|
|
|
477
477
|
this.client = client;
|
|
478
478
|
}
|
|
479
479
|
async autocomplete(input, sessionToken) {
|
|
480
|
-
return
|
|
480
|
+
return chunk3HU5I5VG_js.safe(
|
|
481
481
|
this.client.post("/api/v1/places/autocomplete", {
|
|
482
482
|
input,
|
|
483
483
|
sessionToken
|
|
@@ -485,7 +485,7 @@ var PlacesService = class {
|
|
|
485
485
|
);
|
|
486
486
|
}
|
|
487
487
|
async details(placeId, sessionToken) {
|
|
488
|
-
return
|
|
488
|
+
return chunk3HU5I5VG_js.safe(
|
|
489
489
|
this.client.post("/api/v1/places/details", {
|
|
490
490
|
place_id: placeId,
|
|
491
491
|
sessionToken
|
|
@@ -504,7 +504,7 @@ var DeliveryService = class {
|
|
|
504
504
|
params.set("dropoff_lat", String(dropoffLat));
|
|
505
505
|
params.set("dropoff_lng", String(dropoffLng));
|
|
506
506
|
if (country) params.set("country", country);
|
|
507
|
-
return
|
|
507
|
+
return chunk3HU5I5VG_js.safe(this.client.get(`/api/v1/delivery/fee?${params.toString()}`));
|
|
508
508
|
}
|
|
509
509
|
async getOptions(queryOrLatitude, longitude, legacyOptions) {
|
|
510
510
|
const query = typeof queryOrLatitude === "number" ? {
|
|
@@ -516,8 +516,9 @@ var DeliveryService = class {
|
|
|
516
516
|
if (query.dropoffLat != null) params.set("dropoff_lat", String(query.dropoffLat));
|
|
517
517
|
if (query.dropoffLng != null) params.set("dropoff_lng", String(query.dropoffLng));
|
|
518
518
|
if (query.country) params.set("country", query.country);
|
|
519
|
+
if (query.currency) params.set("currency", query.currency);
|
|
519
520
|
if (query.orderValue != null) params.set("order_value", String(query.orderValue));
|
|
520
|
-
return
|
|
521
|
+
return chunk3HU5I5VG_js.safe(
|
|
521
522
|
this.client.get(`/api/v1/delivery/options?${params.toString()}`)
|
|
522
523
|
);
|
|
523
524
|
}
|
|
@@ -594,7 +595,7 @@ var SupportService = class {
|
|
|
594
595
|
async claimConversation() {
|
|
595
596
|
const accessToken = this.client.getAccessToken();
|
|
596
597
|
if (!accessToken) {
|
|
597
|
-
return
|
|
598
|
+
return chunk3HU5I5VG_js.err(new chunkNIOUSKQQ_js.CimplifyError("not_authenticated", "No access token to claim with"));
|
|
598
599
|
}
|
|
599
600
|
if (this.claimInFlight) {
|
|
600
601
|
if (this.claimInFlightToken === accessToken) return this.claimInFlight;
|
|
@@ -602,12 +603,12 @@ var SupportService = class {
|
|
|
602
603
|
return this.claimConversation();
|
|
603
604
|
}
|
|
604
605
|
if (this.lastClaimedAccessToken === accessToken) {
|
|
605
|
-
return
|
|
606
|
+
return chunk3HU5I5VG_js.err(new chunkNIOUSKQQ_js.CimplifyError("already_claimed", "Session already claimed for this token"));
|
|
606
607
|
}
|
|
607
608
|
const epoch = this.client.getSessionEpoch();
|
|
608
609
|
this.claimInFlightToken = accessToken;
|
|
609
610
|
this.claimInFlight = (async () => {
|
|
610
|
-
const result = await
|
|
611
|
+
const result = await chunk3HU5I5VG_js.safe(
|
|
611
612
|
this.client.post(
|
|
612
613
|
"/api/v1/support/conversation/claim",
|
|
613
614
|
{ access_token: accessToken },
|
|
@@ -616,7 +617,7 @@ var SupportService = class {
|
|
|
616
617
|
);
|
|
617
618
|
if (result.ok) {
|
|
618
619
|
if (this.client.getSessionEpoch() !== epoch) {
|
|
619
|
-
return
|
|
620
|
+
return chunk3HU5I5VG_js.err(
|
|
620
621
|
new chunkNIOUSKQQ_js.CimplifyError("session_cleared", "Session was cleared during the claim")
|
|
621
622
|
);
|
|
622
623
|
}
|
|
@@ -645,20 +646,20 @@ var SupportService = class {
|
|
|
645
646
|
* the inbox with empty threads.
|
|
646
647
|
*/
|
|
647
648
|
async peekConversation() {
|
|
648
|
-
const result = await
|
|
649
|
+
const result = await chunk3HU5I5VG_js.safe(
|
|
649
650
|
this.client.get("/api/v1/support/conversation")
|
|
650
651
|
);
|
|
651
652
|
if (!result.ok) return result;
|
|
652
|
-
if (!result.value.conversation) return
|
|
653
|
-
return
|
|
653
|
+
if (!result.value.conversation) return chunk3HU5I5VG_js.ok(null);
|
|
654
|
+
return chunk3HU5I5VG_js.ok({
|
|
654
655
|
conversation: result.value.conversation,
|
|
655
656
|
messages: result.value.messages
|
|
656
657
|
});
|
|
657
658
|
}
|
|
658
659
|
/** Open (or resume) the customer's widget conversation. */
|
|
659
660
|
async openConversation(opts) {
|
|
660
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
661
|
-
return
|
|
661
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunk3HU5I5VG_js.generateIdempotencyKey();
|
|
662
|
+
return chunk3HU5I5VG_js.safe(
|
|
662
663
|
this.client.post("/api/v1/support/conversation", void 0, {
|
|
663
664
|
idempotencyKey
|
|
664
665
|
})
|
|
@@ -673,8 +674,8 @@ var SupportService = class {
|
|
|
673
674
|
* server resolves it thread-scoped and echoes the quote as `reply_to`.
|
|
674
675
|
*/
|
|
675
676
|
async sendMessage(content, opts) {
|
|
676
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
677
|
-
return
|
|
677
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunk3HU5I5VG_js.generateIdempotencyKey();
|
|
678
|
+
return chunk3HU5I5VG_js.safe(
|
|
678
679
|
this.client.post(
|
|
679
680
|
"/api/v1/support/conversation/messages",
|
|
680
681
|
{
|
|
@@ -698,11 +699,11 @@ var SupportService = class {
|
|
|
698
699
|
if (options.limit) params.set("limit", String(options.limit));
|
|
699
700
|
const query = params.toString();
|
|
700
701
|
const path = query ? `/api/v1/support/conversation/messages?${query}` : "/api/v1/support/conversation/messages";
|
|
701
|
-
return
|
|
702
|
+
return chunk3HU5I5VG_js.safe(this.client.get(path));
|
|
702
703
|
}
|
|
703
704
|
/** React to a message in the active conversation by its `ChatMessage.id`. */
|
|
704
705
|
async reactToMessage(messageId, emoji) {
|
|
705
|
-
return
|
|
706
|
+
return chunk3HU5I5VG_js.safe(
|
|
706
707
|
this.client.post(
|
|
707
708
|
`/api/v1/support/conversation/messages/${messageId}/reactions`,
|
|
708
709
|
{ emoji }
|
|
@@ -711,8 +712,8 @@ var SupportService = class {
|
|
|
711
712
|
}
|
|
712
713
|
/** Ask for a person: flags the thread for the merchant's inbox. */
|
|
713
714
|
async requestHuman(opts) {
|
|
714
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
715
|
-
return
|
|
715
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunk3HU5I5VG_js.generateIdempotencyKey();
|
|
716
|
+
return chunk3HU5I5VG_js.safe(
|
|
716
717
|
this.client.post(
|
|
717
718
|
"/api/v1/support/conversation/handoff",
|
|
718
719
|
void 0,
|
|
@@ -1437,25 +1438,25 @@ var CimplifyClient = class {
|
|
|
1437
1438
|
}
|
|
1438
1439
|
get catalogue() {
|
|
1439
1440
|
if (!this._catalogue) {
|
|
1440
|
-
this._catalogue = new
|
|
1441
|
+
this._catalogue = new chunk3HU5I5VG_js.CatalogueQueries(this);
|
|
1441
1442
|
}
|
|
1442
1443
|
return this._catalogue;
|
|
1443
1444
|
}
|
|
1444
1445
|
get cart() {
|
|
1445
1446
|
if (!this._cart) {
|
|
1446
|
-
this._cart = new
|
|
1447
|
+
this._cart = new chunk3HU5I5VG_js.CartOperations(this);
|
|
1447
1448
|
}
|
|
1448
1449
|
return this._cart;
|
|
1449
1450
|
}
|
|
1450
1451
|
get checkout() {
|
|
1451
1452
|
if (!this._checkout) {
|
|
1452
|
-
this._checkout = new
|
|
1453
|
+
this._checkout = new chunk3HU5I5VG_js.CheckoutService(this);
|
|
1453
1454
|
}
|
|
1454
1455
|
return this._checkout;
|
|
1455
1456
|
}
|
|
1456
1457
|
get orders() {
|
|
1457
1458
|
if (!this._orders) {
|
|
1458
|
-
this._orders = new
|
|
1459
|
+
this._orders = new chunk3HU5I5VG_js.OrderQueries(this);
|
|
1459
1460
|
}
|
|
1460
1461
|
return this._orders;
|
|
1461
1462
|
}
|
|
@@ -1485,43 +1486,43 @@ var CimplifyClient = class {
|
|
|
1485
1486
|
}
|
|
1486
1487
|
get link() {
|
|
1487
1488
|
if (!this._link) {
|
|
1488
|
-
this._link = new
|
|
1489
|
+
this._link = new chunk3HU5I5VG_js.LinkService(this);
|
|
1489
1490
|
}
|
|
1490
1491
|
return this._link;
|
|
1491
1492
|
}
|
|
1492
1493
|
get auth() {
|
|
1493
1494
|
if (!this._auth) {
|
|
1494
|
-
this._auth = new
|
|
1495
|
+
this._auth = new chunk3HU5I5VG_js.AuthService(this);
|
|
1495
1496
|
}
|
|
1496
1497
|
return this._auth;
|
|
1497
1498
|
}
|
|
1498
1499
|
get business() {
|
|
1499
1500
|
if (!this._business) {
|
|
1500
|
-
this._business = new
|
|
1501
|
+
this._business = new chunk3HU5I5VG_js.BusinessService(this);
|
|
1501
1502
|
}
|
|
1502
1503
|
return this._business;
|
|
1503
1504
|
}
|
|
1504
1505
|
get inventory() {
|
|
1505
1506
|
if (!this._inventory) {
|
|
1506
|
-
this._inventory = new
|
|
1507
|
+
this._inventory = new chunk3HU5I5VG_js.InventoryService(this);
|
|
1507
1508
|
}
|
|
1508
1509
|
return this._inventory;
|
|
1509
1510
|
}
|
|
1510
1511
|
get scheduling() {
|
|
1511
1512
|
if (!this._scheduling) {
|
|
1512
|
-
this._scheduling = new
|
|
1513
|
+
this._scheduling = new chunk3HU5I5VG_js.SchedulingService(this);
|
|
1513
1514
|
}
|
|
1514
1515
|
return this._scheduling;
|
|
1515
1516
|
}
|
|
1516
1517
|
get lite() {
|
|
1517
1518
|
if (!this._lite) {
|
|
1518
|
-
this._lite = new
|
|
1519
|
+
this._lite = new chunk3HU5I5VG_js.LiteService(this);
|
|
1519
1520
|
}
|
|
1520
1521
|
return this._lite;
|
|
1521
1522
|
}
|
|
1522
1523
|
get fx() {
|
|
1523
1524
|
if (!this._fx) {
|
|
1524
|
-
this._fx = new
|
|
1525
|
+
this._fx = new chunk3HU5I5VG_js.FxService(this);
|
|
1525
1526
|
}
|
|
1526
1527
|
return this._fx;
|
|
1527
1528
|
}
|
|
@@ -1556,7 +1557,7 @@ var CimplifyClient = class {
|
|
|
1556
1557
|
if (businessId) {
|
|
1557
1558
|
this.setBusinessId(businessId);
|
|
1558
1559
|
}
|
|
1559
|
-
return
|
|
1560
|
+
return chunk3HU5I5VG_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
|
|
1560
1561
|
}
|
|
1561
1562
|
};
|
|
1562
1563
|
function createCimplifyClient(config = {}) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkPNTINRAU_js = require('./chunk-PNTINRAU.js');
|
|
4
|
+
var chunkJEVCHTKZ_js = require('./chunk-JEVCHTKZ.js');
|
|
5
5
|
var zod = require('zod');
|
|
6
6
|
|
|
7
7
|
var cimplifyRegistry = zod.z.registry();
|
|
@@ -600,7 +600,7 @@ async function toForwardedRequest(input, init) {
|
|
|
600
600
|
};
|
|
601
601
|
}
|
|
602
602
|
function createTestClient(options = {}) {
|
|
603
|
-
const mock =
|
|
603
|
+
const mock = chunkPNTINRAU_js.createMockApp(options);
|
|
604
604
|
let sessionToken;
|
|
605
605
|
const fetchImpl = async (input, init) => {
|
|
606
606
|
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
@@ -619,7 +619,7 @@ function createTestClient(options = {}) {
|
|
|
619
619
|
if (echoed) sessionToken = echoed;
|
|
620
620
|
return res;
|
|
621
621
|
};
|
|
622
|
-
const client =
|
|
622
|
+
const client = chunkJEVCHTKZ_js.createCimplifyClient({
|
|
623
623
|
baseUrl: TEST_BASE_URL,
|
|
624
624
|
// Link mock lives at /v1/link on the same Hono app, so point the SDK's
|
|
625
625
|
// separate Link transport at the same TEST_BASE_URL.
|
|
@@ -5624,6 +5624,13 @@ function createLiteService(opts) {
|
|
|
5624
5624
|
}
|
|
5625
5625
|
|
|
5626
5626
|
// src/mock/domain/link.ts
|
|
5627
|
+
var LOCATION_FIELDS = [
|
|
5628
|
+
"street_address",
|
|
5629
|
+
"city",
|
|
5630
|
+
"region",
|
|
5631
|
+
"postal_code",
|
|
5632
|
+
"country"
|
|
5633
|
+
];
|
|
5627
5634
|
var NOT_ENROLLED_ERROR = () => {
|
|
5628
5635
|
throw {
|
|
5629
5636
|
code: "NOT_ENROLLED",
|
|
@@ -5800,7 +5807,30 @@ function createLinkService({ clock, ids }) {
|
|
|
5800
5807
|
},
|
|
5801
5808
|
updateAddress(customerId, id, patch) {
|
|
5802
5809
|
const a = this.getAddressById(customerId, id);
|
|
5803
|
-
|
|
5810
|
+
const {
|
|
5811
|
+
clear_coordinates: clearCoordinates = false,
|
|
5812
|
+
latitude,
|
|
5813
|
+
longitude,
|
|
5814
|
+
...changes
|
|
5815
|
+
} = patch;
|
|
5816
|
+
const hasLatitude = latitude !== void 0;
|
|
5817
|
+
const hasLongitude = longitude !== void 0;
|
|
5818
|
+
if (hasLatitude !== hasLongitude) {
|
|
5819
|
+
throw new Error("latitude and longitude must be supplied together");
|
|
5820
|
+
}
|
|
5821
|
+
if (clearCoordinates && hasLatitude) {
|
|
5822
|
+
throw new Error("clear_coordinates cannot be combined with coordinates");
|
|
5823
|
+
}
|
|
5824
|
+
const locationChanged = LOCATION_FIELDS.some((field) => field in changes);
|
|
5825
|
+
Object.assign(a, changes);
|
|
5826
|
+
if (hasLatitude && hasLongitude) {
|
|
5827
|
+
a.latitude = latitude ?? null;
|
|
5828
|
+
a.longitude = longitude ?? null;
|
|
5829
|
+
} else if (clearCoordinates || locationChanged) {
|
|
5830
|
+
a.latitude = null;
|
|
5831
|
+
a.longitude = null;
|
|
5832
|
+
}
|
|
5833
|
+
a.updated_at = clock.iso();
|
|
5804
5834
|
return a;
|
|
5805
5835
|
},
|
|
5806
5836
|
deleteAddress(customerId, id) {
|
|
@@ -5622,6 +5622,13 @@ function createLiteService(opts) {
|
|
|
5622
5622
|
}
|
|
5623
5623
|
|
|
5624
5624
|
// src/mock/domain/link.ts
|
|
5625
|
+
var LOCATION_FIELDS = [
|
|
5626
|
+
"street_address",
|
|
5627
|
+
"city",
|
|
5628
|
+
"region",
|
|
5629
|
+
"postal_code",
|
|
5630
|
+
"country"
|
|
5631
|
+
];
|
|
5625
5632
|
var NOT_ENROLLED_ERROR = () => {
|
|
5626
5633
|
throw {
|
|
5627
5634
|
code: "NOT_ENROLLED",
|
|
@@ -5798,7 +5805,30 @@ function createLinkService({ clock, ids }) {
|
|
|
5798
5805
|
},
|
|
5799
5806
|
updateAddress(customerId, id, patch) {
|
|
5800
5807
|
const a = this.getAddressById(customerId, id);
|
|
5801
|
-
|
|
5808
|
+
const {
|
|
5809
|
+
clear_coordinates: clearCoordinates = false,
|
|
5810
|
+
latitude,
|
|
5811
|
+
longitude,
|
|
5812
|
+
...changes
|
|
5813
|
+
} = patch;
|
|
5814
|
+
const hasLatitude = latitude !== void 0;
|
|
5815
|
+
const hasLongitude = longitude !== void 0;
|
|
5816
|
+
if (hasLatitude !== hasLongitude) {
|
|
5817
|
+
throw new Error("latitude and longitude must be supplied together");
|
|
5818
|
+
}
|
|
5819
|
+
if (clearCoordinates && hasLatitude) {
|
|
5820
|
+
throw new Error("clear_coordinates cannot be combined with coordinates");
|
|
5821
|
+
}
|
|
5822
|
+
const locationChanged = LOCATION_FIELDS.some((field) => field in changes);
|
|
5823
|
+
Object.assign(a, changes);
|
|
5824
|
+
if (hasLatitude && hasLongitude) {
|
|
5825
|
+
a.latitude = latitude ?? null;
|
|
5826
|
+
a.longitude = longitude ?? null;
|
|
5827
|
+
} else if (clearCoordinates || locationChanged) {
|
|
5828
|
+
a.latitude = null;
|
|
5829
|
+
a.longitude = null;
|
|
5830
|
+
}
|
|
5831
|
+
a.updated_at = clock.iso();
|
|
5802
5832
|
return a;
|
|
5803
5833
|
},
|
|
5804
5834
|
deleteAddress(customerId, id) {
|