@cimplify/sdk 0.104.0 → 0.105.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 +3 -7
- package/dist/advanced.d.ts +3 -7
- package/dist/advanced.js +23 -23
- package/dist/advanced.mjs +4 -4
- package/dist/{client-BuLcOWLv.d.ts → catalogue-D1jkpGcr.d.ts} +415 -763
- package/dist/{client-D5AoobFc.d.mts → catalogue-DjutZ0FC.d.mts} +415 -763
- package/dist/{payment-g0HFkEDU.d.mts → checkout-XoV4HNg2.d.mts} +4156 -1498
- package/dist/{payment-g0HFkEDU.d.ts → checkout-XoV4HNg2.d.ts} +4156 -1498
- package/dist/{chunk-GOHSXBKW.mjs → chunk-33VCYWVL.mjs} +25 -1
- package/dist/{chunk-OKADBZAI.mjs → chunk-37ZZCE7P.mjs} +808 -574
- package/dist/{chunk-5BDYDZ4U.js → chunk-3IMPJEUI.js} +892 -657
- package/dist/{chunk-YVAEY3VC.js → chunk-7PMMV5X4.js} +1040 -364
- package/dist/{chunk-H3RATH4B.mjs → chunk-AVXA4F6G.js} +293 -2
- package/dist/{chunk-CNN7Z2IP.js → chunk-EV2EVOYS.js} +27 -0
- package/dist/{chunk-4BKOKHE3.js → chunk-NJYR6GGM.mjs} +244 -19
- package/dist/{chunk-DYIAX3WI.mjs → chunk-NYDVVNZI.mjs} +11 -2
- package/dist/{chunk-E4K2VQDD.js → chunk-PDTXSUHZ.js} +559 -16
- package/dist/{chunk-2WPVUIHX.mjs → chunk-Q5HX7LVE.mjs} +1036 -360
- package/dist/{chunk-5RT4HYMP.mjs → chunk-TINYV5E2.mjs} +542 -15
- package/dist/{chunk-7PDEX54K.js → chunk-UYFTOIFW.js} +13 -3
- package/dist/{chunk-OCCNG6MO.mjs → chunk-X7RPMALQ.mjs} +1310 -722
- package/dist/{chunk-IQFFSKE2.js → chunk-XHVQDEVO.js} +1345 -746
- package/dist/{client-BVNWjk6W.d.ts → client-BBZj15JJ.d.ts} +2 -2
- package/dist/{client-fM716k7G.d.mts → client-CZ8MjJ_o.d.mts} +2 -2
- package/dist/index-CZjNWbQf.d.ts +8 -0
- package/dist/index-DNxWfRHF.d.mts +8 -0
- package/dist/{index-BtcoqrY1.d.ts → index-DRMBo26v.d.mts} +9 -4
- package/dist/{index-D7Tf3v7c.d.mts → index-DweR60Cv.d.ts} +9 -4
- package/dist/index.d.mts +31 -14
- package/dist/index.d.ts +31 -14
- package/dist/index.js +325 -133
- package/dist/index.mjs +6 -6
- package/dist/mock/cli.mjs +1450 -386
- package/dist/mock/library.js +1176 -352
- package/dist/mock/library.mjs +1176 -352
- package/dist/mock/msw.js +1176 -352
- package/dist/mock/msw.mjs +1176 -352
- package/dist/{price-BLIeAb8K.d.ts → price-CUGIYRtD.d.mts} +1 -1
- package/dist/{price-Czq_cTC_.d.mts → price-De-sxcuj.d.ts} +1 -1
- package/dist/react.d.mts +10 -5
- package/dist/react.d.ts +10 -5
- package/dist/react.js +227 -197
- package/dist/react.mjs +90 -60
- package/dist/{server-DKK_D-PP.d.ts → server-Byr4d0hL.d.mts} +31 -57
- package/dist/{server-BkVhOIwn.d.mts → server-C_RIDnHU.d.ts} +31 -57
- package/dist/server.d.mts +3 -4
- package/dist/server.d.ts +3 -4
- package/dist/server.js +11 -11
- package/dist/server.mjs +5 -5
- package/dist/styles.css +2 -2
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +4 -4
- package/dist/testing/msw.mjs +3 -3
- package/dist/testing/suite.d.mts +5 -6
- package/dist/testing/suite.d.ts +5 -6
- package/dist/testing/suite.js +29 -28
- package/dist/testing/suite.mjs +10 -9
- package/dist/testing.d.mts +2478 -14
- package/dist/testing.d.ts +2478 -14
- package/dist/testing.js +167 -89
- package/dist/testing.mjs +24 -10
- package/dist/utils.d.mts +3 -4
- package/dist/utils.d.ts +3 -4
- package/dist/utils.js +35 -31
- package/dist/utils.mjs +2 -2
- package/package.json +9 -9
- package/registry/order-history.json +1 -1
- package/registry/order-summary.json +1 -1
- package/dist/link-D9iSVxt5.d.mts +0 -308
- package/dist/link-D9iSVxt5.d.ts +0 -308
package/dist/utils.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkL5GKVQVJ_js = require('./chunk-L5GKVQVJ.js');
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
4
|
+
var chunkUYFTOIFW_js = require('./chunk-UYFTOIFW.js');
|
|
5
|
+
require('./chunk-AVXA4F6G.js');
|
|
6
6
|
require('./chunk-OWW5GUSB.js');
|
|
7
7
|
|
|
8
8
|
|
|
@@ -21,117 +21,121 @@ Object.defineProperty(exports, "resolvePhoneCountryCode", {
|
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "CURRENCY_SYMBOLS", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkUYFTOIFW_js.CURRENCY_SYMBOLS; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "MOBILE_MONEY_PROVIDERS", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkUYFTOIFW_js.MOBILE_MONEY_PROVIDERS; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "canonicalMobileMoneyProvider", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunkUYFTOIFW_js.canonicalMobileMoneyProvider; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "categorizePaymentError", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunkUYFTOIFW_js.categorizePaymentError; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "detectMobileMoneyProvider", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunkUYFTOIFW_js.detectMobileMoneyProvider; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "formatMoney", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunkUYFTOIFW_js.formatMoney; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "formatNumberCompact", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunkUYFTOIFW_js.formatNumberCompact; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "formatPrice", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkUYFTOIFW_js.formatPrice; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "formatPriceAdjustment", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunkUYFTOIFW_js.formatPriceAdjustment; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "formatPriceCompact", {
|
|
59
59
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunkUYFTOIFW_js.formatPriceCompact; }
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "formatPriceWithTax", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunkUYFTOIFW_js.formatPriceWithTax; }
|
|
65
65
|
});
|
|
66
66
|
Object.defineProperty(exports, "formatProductPrice", {
|
|
67
67
|
enumerable: true,
|
|
68
|
-
get: function () { return
|
|
68
|
+
get: function () { return chunkUYFTOIFW_js.formatProductPrice; }
|
|
69
69
|
});
|
|
70
70
|
Object.defineProperty(exports, "getBasePrice", {
|
|
71
71
|
enumerable: true,
|
|
72
|
-
get: function () { return
|
|
72
|
+
get: function () { return chunkUYFTOIFW_js.getBasePrice; }
|
|
73
73
|
});
|
|
74
74
|
Object.defineProperty(exports, "getCurrencySymbol", {
|
|
75
75
|
enumerable: true,
|
|
76
|
-
get: function () { return
|
|
76
|
+
get: function () { return chunkUYFTOIFW_js.getCurrencySymbol; }
|
|
77
77
|
});
|
|
78
78
|
Object.defineProperty(exports, "getDiscountPercentage", {
|
|
79
79
|
enumerable: true,
|
|
80
|
-
get: function () { return
|
|
80
|
+
get: function () { return chunkUYFTOIFW_js.getDiscountPercentage; }
|
|
81
81
|
});
|
|
82
82
|
Object.defineProperty(exports, "getDisplayPrice", {
|
|
83
83
|
enumerable: true,
|
|
84
|
-
get: function () { return
|
|
84
|
+
get: function () { return chunkUYFTOIFW_js.getDisplayPrice; }
|
|
85
85
|
});
|
|
86
86
|
Object.defineProperty(exports, "getMarkupPercentage", {
|
|
87
87
|
enumerable: true,
|
|
88
|
-
get: function () { return
|
|
88
|
+
get: function () { return chunkUYFTOIFW_js.getMarkupPercentage; }
|
|
89
89
|
});
|
|
90
90
|
Object.defineProperty(exports, "getProductCurrency", {
|
|
91
91
|
enumerable: true,
|
|
92
|
-
get: function () { return
|
|
92
|
+
get: function () { return chunkUYFTOIFW_js.getProductCurrency; }
|
|
93
93
|
});
|
|
94
94
|
Object.defineProperty(exports, "getTaxAmount", {
|
|
95
95
|
enumerable: true,
|
|
96
|
-
get: function () { return
|
|
96
|
+
get: function () { return chunkUYFTOIFW_js.getTaxAmount; }
|
|
97
97
|
});
|
|
98
98
|
Object.defineProperty(exports, "hasTaxInfo", {
|
|
99
99
|
enumerable: true,
|
|
100
|
-
get: function () { return
|
|
100
|
+
get: function () { return chunkUYFTOIFW_js.hasTaxInfo; }
|
|
101
101
|
});
|
|
102
102
|
Object.defineProperty(exports, "isOnSale", {
|
|
103
103
|
enumerable: true,
|
|
104
|
-
get: function () { return
|
|
104
|
+
get: function () { return chunkUYFTOIFW_js.isOnSale; }
|
|
105
105
|
});
|
|
106
106
|
Object.defineProperty(exports, "isPaymentStatusFailure", {
|
|
107
107
|
enumerable: true,
|
|
108
|
-
get: function () { return
|
|
108
|
+
get: function () { return chunkUYFTOIFW_js.isPaymentStatusFailure; }
|
|
109
109
|
});
|
|
110
110
|
Object.defineProperty(exports, "isPaymentStatusRequiresAction", {
|
|
111
111
|
enumerable: true,
|
|
112
|
-
get: function () { return
|
|
112
|
+
get: function () { return chunkUYFTOIFW_js.isPaymentStatusRequiresAction; }
|
|
113
113
|
});
|
|
114
114
|
Object.defineProperty(exports, "isPaymentStatusSuccess", {
|
|
115
115
|
enumerable: true,
|
|
116
|
-
get: function () { return
|
|
116
|
+
get: function () { return chunkUYFTOIFW_js.isPaymentStatusSuccess; }
|
|
117
117
|
});
|
|
118
118
|
Object.defineProperty(exports, "isTaxInclusive", {
|
|
119
119
|
enumerable: true,
|
|
120
|
-
get: function () { return
|
|
120
|
+
get: function () { return chunkUYFTOIFW_js.isTaxInclusive; }
|
|
121
121
|
});
|
|
122
122
|
Object.defineProperty(exports, "normalizePaymentResponse", {
|
|
123
123
|
enumerable: true,
|
|
124
|
-
get: function () { return
|
|
124
|
+
get: function () { return chunkUYFTOIFW_js.normalizePaymentResponse; }
|
|
125
125
|
});
|
|
126
126
|
Object.defineProperty(exports, "normalizeStatusResponse", {
|
|
127
127
|
enumerable: true,
|
|
128
|
-
get: function () { return
|
|
128
|
+
get: function () { return chunkUYFTOIFW_js.normalizeStatusResponse; }
|
|
129
129
|
});
|
|
130
130
|
Object.defineProperty(exports, "parsePrice", {
|
|
131
131
|
enumerable: true,
|
|
132
|
-
get: function () { return
|
|
132
|
+
get: function () { return chunkUYFTOIFW_js.parsePrice; }
|
|
133
133
|
});
|
|
134
134
|
Object.defineProperty(exports, "paymentAuthorizationUrl", {
|
|
135
135
|
enumerable: true,
|
|
136
|
-
get: function () { return
|
|
136
|
+
get: function () { return chunkUYFTOIFW_js.paymentAuthorizationUrl; }
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "purchaseIntentMobileMoneyNetwork", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function () { return chunkUYFTOIFW_js.purchaseIntentMobileMoneyNetwork; }
|
|
137
141
|
});
|
package/dist/utils.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { isValidPhoneForContext, normalizePhoneToE164, resolvePhoneCountryCode } from './chunk-YOIVZ6OA.mjs';
|
|
2
|
-
export { CURRENCY_SYMBOLS, MOBILE_MONEY_PROVIDERS, canonicalMobileMoneyProvider, categorizePaymentError, detectMobileMoneyProvider, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatPriceWithTax, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, getTaxAmount, hasTaxInfo, isOnSale, isPaymentStatusFailure, isPaymentStatusRequiresAction, isPaymentStatusSuccess, isTaxInclusive, normalizePaymentResponse, normalizeStatusResponse, parsePrice, paymentAuthorizationUrl } from './chunk-
|
|
3
|
-
import './chunk-
|
|
2
|
+
export { CURRENCY_SYMBOLS, MOBILE_MONEY_PROVIDERS, canonicalMobileMoneyProvider, categorizePaymentError, detectMobileMoneyProvider, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatPriceWithTax, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, getTaxAmount, hasTaxInfo, isOnSale, isPaymentStatusFailure, isPaymentStatusRequiresAction, isPaymentStatusSuccess, isTaxInclusive, normalizePaymentResponse, normalizeStatusResponse, parsePrice, paymentAuthorizationUrl, purchaseIntentMobileMoneyNetwork } from './chunk-NYDVVNZI.mjs';
|
|
3
|
+
import './chunk-NJYR6GGM.mjs';
|
|
4
4
|
import './chunk-3G6RQLXK.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cimplify/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.105.0",
|
|
4
4
|
"description": "Cimplify Commerce SDK for storefronts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cimplify",
|
|
@@ -148,34 +148,34 @@
|
|
|
148
148
|
},
|
|
149
149
|
"devDependencies": {
|
|
150
150
|
"@cloudflare/workers-types": "^4.20260616.1",
|
|
151
|
-
"@hono/node-server": "^2.
|
|
152
|
-
"@opennextjs/aws": "^4.0
|
|
153
|
-
"@opennextjs/cloudflare": "^1.
|
|
151
|
+
"@hono/node-server": "^2.1.1",
|
|
152
|
+
"@opennextjs/aws": "^4.1.0",
|
|
153
|
+
"@opennextjs/cloudflare": "^1.20.2",
|
|
154
154
|
"@paystack/inline-js": "^2.23.0",
|
|
155
155
|
"@stripe/stripe-js": "^9.12.0",
|
|
156
|
-
"@tailwindcss/cli": "4.3.
|
|
156
|
+
"@tailwindcss/cli": "4.3.3",
|
|
157
157
|
"@testing-library/dom": "^10.4.1",
|
|
158
158
|
"@testing-library/react": "^16.3.2",
|
|
159
159
|
"@types/node": "^25.9.3",
|
|
160
160
|
"@types/react": "^19.2.14",
|
|
161
161
|
"@types/react-dom": "^19.2.3",
|
|
162
162
|
"@typescript/native-preview": "^7.0.0-dev.20260616.1",
|
|
163
|
-
"hono": "^4.
|
|
163
|
+
"hono": "^4.13.2",
|
|
164
164
|
"jsdom": "^29.1.1",
|
|
165
165
|
"msw": "^2.14.6",
|
|
166
166
|
"openapi-typescript": "^7.13.0",
|
|
167
167
|
"react": "^19.2.7",
|
|
168
168
|
"react-dom": "^19.2.7",
|
|
169
|
-
"tailwindcss": "4.3.
|
|
169
|
+
"tailwindcss": "4.3.3",
|
|
170
170
|
"tsup": "^8.5.1",
|
|
171
171
|
"typescript": "6.0.3",
|
|
172
|
-
"vitest": "^4.1.
|
|
172
|
+
"vitest": "^4.1.10"
|
|
173
173
|
},
|
|
174
174
|
"dependencies": {
|
|
175
175
|
"@base-ui/react": "^1.5.0",
|
|
176
176
|
"clsx": "^2.1.1",
|
|
177
177
|
"date-fns": "^4.4.0",
|
|
178
|
-
"dompurify": "3.4.
|
|
178
|
+
"dompurify": "3.4.13",
|
|
179
179
|
"jose": "^6.2.3",
|
|
180
180
|
"libphonenumber-js": "1.13.6",
|
|
181
181
|
"marked": "18.0.5",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
{
|
|
12
12
|
"path": "order-history.tsx",
|
|
13
|
-
"content": "\"use client\";\n\nimport React from \"react\";\nimport type { Order, OrderStatus } from \"@cimplify/sdk\";\nimport { useOrders } from \"@cimplify/sdk/react\";\nimport { Price } from \"@cimplify/sdk/react\";\nimport { cn } from \"@cimplify/sdk/react\";\n\nexport interface OrderHistoryClassNames {\n root?: string;\n item?: string;\n orderId?: string;\n status?: string;\n date?: string;\n total?: string;\n empty?: string;\n loading?: string;\n reorderButton?: string;\n}\n\nexport interface OrderHistoryProps {\n /** Override orders (skips fetch). For SSR, pass pre-fetched orders. */\n orders?: Order[];\n /** Filter by status. */\n status?: OrderStatus;\n /** Max orders to display. */\n limit?: number;\n /** Called when an order row is clicked. */\n onOrderClick?: (order: Order) => void;\n /** Custom order row renderer. */\n renderOrder?: (order: Order) => React.ReactNode;\n /** Called when the reorder button is clicked. If provided, a reorder button is rendered. */\n onReorder?: (order: Order) => void;\n /** Text shown when empty. */\n emptyMessage?: string;\n className?: string;\n classNames?: OrderHistoryClassNames;\n}\n\nconst STATUS_LABELS: Record<OrderStatus, string> = {\n pending: \"Pending\",\n created: \"Created\",\n confirmed: \"Confirmed\",\n in_preparation: \"In Preparation\",\n ready_to_serve: \"Ready\",\n partially_served: \"Partially Served\",\n served: \"Served\",\n delivered: \"Delivered\",\n picked_up: \"Picked Up\",\n completed: \"Completed\",\n cancelled: \"Cancelled\",\n
|
|
13
|
+
"content": "\"use client\";\n\nimport React from \"react\";\nimport type { Order, OrderStatus } from \"@cimplify/sdk\";\nimport { useOrders } from \"@cimplify/sdk/react\";\nimport { Price } from \"@cimplify/sdk/react\";\nimport { cn } from \"@cimplify/sdk/react\";\n\nexport interface OrderHistoryClassNames {\n root?: string;\n item?: string;\n orderId?: string;\n status?: string;\n date?: string;\n total?: string;\n empty?: string;\n loading?: string;\n reorderButton?: string;\n}\n\nexport interface OrderHistoryProps {\n /** Override orders (skips fetch). For SSR, pass pre-fetched orders. */\n orders?: Order[];\n /** Filter by status. */\n status?: OrderStatus;\n /** Max orders to display. */\n limit?: number;\n /** Called when an order row is clicked. */\n onOrderClick?: (order: Order) => void;\n /** Custom order row renderer. */\n renderOrder?: (order: Order) => React.ReactNode;\n /** Called when the reorder button is clicked. If provided, a reorder button is rendered. */\n onReorder?: (order: Order) => void;\n /** Text shown when empty. */\n emptyMessage?: string;\n className?: string;\n classNames?: OrderHistoryClassNames;\n}\n\nconst STATUS_LABELS: Record<OrderStatus, string> = {\n pending: \"Pending\",\n created: \"Created\",\n confirmed: \"Confirmed\",\n in_preparation: \"In Preparation\",\n ready_to_serve: \"Ready\",\n partially_served: \"Partially Served\",\n served: \"Served\",\n delivered: \"Delivered\",\n picked_up: \"Picked Up\",\n completed: \"Completed\",\n cancelled: \"Cancelled\",\n};\n\n/**\n * OrderHistory — list of past orders with status and totals.\n *\n * Fetches via `useOrders` unless pre-loaded orders are passed.\n */\nexport function OrderHistory({\n orders: ordersProp,\n status,\n limit,\n onOrderClick,\n renderOrder,\n onReorder,\n emptyMessage = \"No orders yet\",\n className,\n classNames,\n}: OrderHistoryProps): React.ReactElement {\n const { orders: fetched, isLoading } = useOrders({\n status,\n limit,\n enabled: ordersProp === undefined,\n });\n\n const orders = ordersProp ?? fetched;\n\n if (isLoading && orders.length === 0) {\n return (\n <div\n data-cimplify-order-history\n aria-busy=\"true\"\n className={cn(className, classNames?.root, classNames?.loading)}\n />\n );\n }\n\n if (orders.length === 0) {\n return (\n <div\n data-cimplify-order-history\n data-empty\n className={cn(className, classNames?.root, classNames?.empty)}\n >\n <p>{emptyMessage}</p>\n </div>\n );\n }\n\n return (\n <div data-cimplify-order-history className={cn(className, classNames?.root)}>\n {orders.map((order) => (\n <button\n key={order.id}\n type=\"button\"\n onClick={() => onOrderClick?.(order)}\n data-cimplify-order-history-item\n data-status={order.status}\n className={classNames?.item}\n >\n {renderOrder ? (\n renderOrder(order)\n ) : (\n <>\n <div data-cimplify-order-history-main>\n <span data-cimplify-order-history-id className={classNames?.orderId}>\n #{order.user_friendly_id}\n </span>\n <span\n data-cimplify-order-history-status\n data-status={order.status}\n className={classNames?.status}\n >\n {STATUS_LABELS[order.status] ?? order.status}\n </span>\n </div>\n <div data-cimplify-order-history-details>\n <time\n data-cimplify-order-history-date\n dateTime={order.created_at}\n className={classNames?.date}\n >\n {new Date(order.created_at).toLocaleDateString()}\n </time>\n <span data-cimplify-order-history-items>\n {order.total_quantity} {order.total_quantity === 1 ? \"item\" : \"items\"}\n </span>\n <span data-cimplify-order-history-total className={classNames?.total}>\n <Price amount={order.total_price} />\n </span>\n </div>\n {onReorder && (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n onReorder(order);\n }}\n data-cimplify-order-reorder\n className={classNames?.reorderButton}\n >\n Reorder\n </button>\n )}\n </>\n )}\n </button>\n ))}\n </div>\n );\n}\n"
|
|
14
14
|
}
|
|
15
15
|
]
|
|
16
16
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
{
|
|
12
12
|
"path": "order-summary.tsx",
|
|
13
|
-
"content": "\"use client\";\n\nimport React from \"react\";\nimport type { Order, LineItem, OrderStatus, PaymentState } from \"@cimplify/sdk\";\nimport { useOrder } from \"@cimplify/sdk/react\";\nimport { Price } from \"@cimplify/sdk/react\";\nimport { parsePrice } from \"@cimplify/sdk\";\nimport { cn } from \"@cimplify/sdk/react\";\n\nexport interface OrderSummaryClassNames {\n root?: string;\n header?: string;\n orderId?: string;\n status?: string;\n paymentState?: string;\n fulfillmentDetails?: string;\n deliveryAddress?: string;\n items?: string;\n lineItem?: string;\n notes?: string;\n totals?: string;\n customer?: string;\n loading?: string;\n serviceInfo?: string;\n digitalInfo?: string;\n bundleBreakdown?: string;\n compositeBreakdown?: string;\n trackingLink?: string;\n reorderButton?: string;\n}\n\nexport interface OrderSummaryProps {\n /** Pass an Order object directly (skips fetch). */\n order?: Order;\n /** Or pass an order ID to fetch via useOrder. */\n orderId?: string;\n /** Poll for status updates. */\n poll?: boolean;\n /** Custom line item renderer. */\n renderLineItem?: (item: LineItem) => React.ReactNode;\n /** Called when the reorder button is clicked. */\n onReorder?: (order: Order) => void;\n /** Called when the order status changes during polling. */\n onStatusChange?: (previousStatus: OrderStatus, newStatus: OrderStatus, order: Order) => void;\n className?: string;\n classNames?: OrderSummaryClassNames;\n}\n\nconst STATUS_LABELS: Record<OrderStatus, string> = {\n pending: \"Pending\",\n created: \"Created\",\n confirmed: \"Confirmed\",\n in_preparation: \"In Preparation\",\n ready_to_serve: \"Ready\",\n partially_served: \"Partially Served\",\n served: \"Served\",\n delivered: \"Delivered\",\n picked_up: \"Picked Up\",\n completed: \"Completed\",\n cancelled: \"Cancelled\",\n refunded: \"Refunded\",\n};\n\nconst PAYMENT_STATE_LABELS: Record<PaymentState, string> = {\n not_paid: \"Not Paid\",\n partially_paid: \"Partially Paid\",\n paid: \"Paid\",\n partially_refunded: \"Partially Refunded\",\n refunded: \"Refunded\",\n};\n\n/**\n * OrderSummary — displays a single order's details, line items, and totals.\n *\n * Accepts either a pre-loaded `order` object or an `orderId` to fetch.\n * Supports polling for live status updates.\n */\nexport function OrderSummary({\n order: orderProp,\n orderId,\n poll = false,\n renderLineItem,\n onReorder,\n onStatusChange,\n className,\n classNames,\n}: OrderSummaryProps): React.ReactElement {\n const { order: fetched, isLoading } = useOrder(orderProp ? null : orderId, {\n enabled: !orderProp && !!orderId,\n poll,\n onStatusChange,\n });\n\n const order = orderProp ?? fetched;\n\n if (isLoading && !order) {\n return (\n <div\n data-cimplify-order-summary\n aria-busy=\"true\"\n className={cn(className, classNames?.root, classNames?.loading)}\n >\n <div data-cimplify-order-summary-skeleton />\n </div>\n );\n }\n\n if (!order) {\n return (\n <div data-cimplify-order-summary className={cn(className, classNames?.root)}>\n <p>Order not found.</p>\n </div>\n );\n }\n\n return (\n <div data-cimplify-order-summary className={cn(className, classNames?.root)}>\n {/* Header */}\n <div data-cimplify-order-header className={classNames?.header}>\n <span data-cimplify-order-id className={classNames?.orderId}>\n Order #{order.user_friendly_id}\n </span>\n <span\n data-cimplify-order-status\n data-status={order.status}\n className={classNames?.status}\n >\n {STATUS_LABELS[order.status] ?? order.status}\n </span>\n {order.payment_state && (\n <span\n data-cimplify-order-payment-state\n data-payment-state={order.payment_state}\n className={classNames?.paymentState}\n >\n {PAYMENT_STATE_LABELS[order.payment_state] ?? order.payment_state}\n </span>\n )}\n </div>\n\n {/* Fulfillment details */}\n {order.order_type === \"pickup\" && order.pickup_time && (\n <div data-cimplify-order-fulfillment className={classNames?.fulfillmentDetails}>\n <span>Pickup time: {new Date(order.pickup_time).toLocaleString()}</span>\n </div>\n )}\n {order.order_type === \"dine-in\" && order.table_number && (\n <div data-cimplify-order-fulfillment className={classNames?.fulfillmentDetails}>\n <span>Table: {order.table_number}</span>\n </div>\n )}\n\n {/* Date */}\n <time data-cimplify-order-date dateTime={order.created_at}>\n {new Date(order.created_at).toLocaleDateString(undefined, {\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n })}\n </time>\n\n {/* Customer info */}\n {(order.customer_name || order.customer_email) && (\n <div data-cimplify-order-customer className={classNames?.customer}>\n {order.customer_name && (\n <span data-cimplify-order-customer-name>{order.customer_name}</span>\n )}\n {order.customer_email && (\n <span data-cimplify-order-customer-email>{order.customer_email}</span>\n )}\n </div>\n )}\n\n {/* Delivery address */}\n {order.delivery_address && (\n <div data-cimplify-order-delivery-address className={classNames?.deliveryAddress}>\n <span>Delivery address</span>\n <p>{order.delivery_address}</p>\n </div>\n )}\n\n {/* Line items */}\n <div data-cimplify-order-items className={classNames?.items}>\n {order.items.map((item) =>\n renderLineItem ? (\n <React.Fragment key={item.id}>{renderLineItem(item)}</React.Fragment>\n ) : (\n <div key={item.id} data-cimplify-order-line-item className={classNames?.lineItem}>\n <div data-cimplify-order-line-info>\n <span data-cimplify-order-line-qty>{item.quantity}×</span>\n <span data-cimplify-order-line-key>{item.line_key}</span>\n </div>\n <Price amount={item.price} />\n {item.fulfillment_type === \"digital\" && item.fulfillment_id && (\n <a\n href={item.fulfillment_id}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-cimplify-order-line-download\n className=\"text-sm text-primary underline\"\n >\n Download\n </a>\n )}\n\n {/* Service items: show scheduling and confirmation details */}\n {item.configuration.type === \"service\" && (\n <div data-cimplify-order-service-info className={classNames?.serviceInfo}>\n {item.configuration.scheduled_start && (\n <span>{\"\\u{1F4C5}\"} {new Date(item.configuration.scheduled_start).toLocaleDateString()} at {new Date(item.configuration.scheduled_start).toLocaleTimeString([], { hour: \"2-digit\", minute: \"2-digit\" })}</span>\n )}\n {item.configuration.confirmation_code && (\n <span>Confirmation: {item.configuration.confirmation_code}</span>\n )}\n {item.configuration.service_status && (\n <span data-status={item.configuration.service_status}>{item.configuration.service_status}</span>\n )}\n </div>\n )}\n\n {/* Digital items: instant delivery badge */}\n {item.configuration.type === \"digital\" && (\n <div data-cimplify-order-digital-info className={classNames?.digitalInfo}>\n <span>{\"\\u26A1\"} Instant digital delivery</span>\n </div>\n )}\n\n {/* Bundle items: component breakdown */}\n {item.configuration.type === \"bundle\" && item.configuration.resolved && (\n <div data-cimplify-order-bundle-breakdown className={classNames?.bundleBreakdown}>\n {item.configuration.resolved.selections.map((sel) => (\n <div key={sel.component_id} data-product-type={sel.product_type}>\n <span>{sel.quantity}× {sel.product_name}</span>\n {sel.product_type === \"service\" && sel.scheduling?.scheduled_start && (\n <span> — {new Date(sel.scheduling.scheduled_start).toLocaleDateString()}</span>\n )}\n {sel.product_type === \"digital\" && <span> — Digital</span>}\n </div>\n ))}\n </div>\n )}\n\n {/* Composite items: component breakdown with pricing */}\n {item.configuration.type === \"composite\" && item.configuration.resolved && (\n <div data-cimplify-order-composite-breakdown className={classNames?.compositeBreakdown}>\n {item.configuration.resolved.selections.map((sel) => (\n <div key={sel.component_id} data-product-type={sel.product_type}>\n <span>{sel.quantity}× {sel.component_name}</span>\n {sel.product_type === \"service\" && sel.scheduling?.scheduled_start && (\n <span> — {new Date(sel.scheduling.scheduled_start).toLocaleDateString()}</span>\n )}\n <Price amount={sel.unit_price} />\n </div>\n ))}\n </div>\n )}\n </div>\n ),\n )}\n </div>\n\n {/* Customer notes / special instructions */}\n {order.customer_notes && order.customer_notes.length > 0 && (\n <div data-cimplify-order-notes className={classNames?.notes}>\n <span>Notes</span>\n {order.customer_notes.map((note, index) => (\n <p key={index} data-cimplify-order-note>{note}</p>\n ))}\n </div>\n )}\n\n {/* Totals */}\n <div data-cimplify-order-totals className={classNames?.totals}>\n {order.total_discount != null && parsePrice(order.total_discount) !== 0 && (\n <div data-cimplify-order-discount>\n <span>Discount</span>\n <Price amount={order.total_discount} prefix=\"-\" />\n </div>\n )}\n {order.delivery_fee != null && parsePrice(order.delivery_fee) > 0 && (\n <div data-cimplify-order-delivery-fee>\n <span>Delivery fee</span>\n <Price amount={order.delivery_fee} />\n </div>\n )}\n {order.service_charge != null && parsePrice(order.service_charge) !== 0 && (\n <div data-cimplify-order-service-charge>\n <span>Service charge</span>\n <Price amount={order.service_charge} />\n </div>\n )}\n {order.tax != null && parsePrice(order.tax) !== 0 && (\n <div data-cimplify-order-tax>\n <span>Tax</span>\n <Price amount={order.tax} />\n </div>\n )}\n <div data-cimplify-order-total>\n <span>Total</span>\n <Price amount={order.total_price} />\n </div>\n </div>\n\n {/* Tracking */}\n {order.tracking_link && (\n <a\n href={order.tracking_link}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-cimplify-order-tracking\n className={classNames?.trackingLink}\n >\n Track your order\n </a>\n )}\n\n {onReorder && (\n <button\n type=\"button\"\n onClick={() => onReorder(order)}\n data-cimplify-order-reorder\n className={classNames?.reorderButton}\n >\n Reorder\n </button>\n )}\n </div>\n );\n}\n"
|
|
13
|
+
"content": "\"use client\";\n\nimport React from \"react\";\nimport type { Order, LineItem, OrderStatus, PaymentState } from \"@cimplify/sdk\";\nimport { useOrder } from \"@cimplify/sdk/react\";\nimport { Price } from \"@cimplify/sdk/react\";\nimport { parsePrice } from \"@cimplify/sdk\";\nimport { cn } from \"@cimplify/sdk/react\";\n\nexport interface OrderSummaryClassNames {\n root?: string;\n header?: string;\n orderId?: string;\n status?: string;\n paymentState?: string;\n fulfillmentDetails?: string;\n deliveryAddress?: string;\n items?: string;\n lineItem?: string;\n notes?: string;\n totals?: string;\n customer?: string;\n loading?: string;\n serviceInfo?: string;\n digitalInfo?: string;\n bundleBreakdown?: string;\n compositeBreakdown?: string;\n trackingLink?: string;\n reorderButton?: string;\n}\n\nexport interface OrderSummaryProps {\n /** Pass an Order object directly (skips fetch). */\n order?: Order;\n /** Or pass an order ID to fetch via useOrder. */\n orderId?: string;\n /** Poll for status updates. */\n poll?: boolean;\n /** Custom line item renderer. */\n renderLineItem?: (item: LineItem) => React.ReactNode;\n /** Called when the reorder button is clicked. */\n onReorder?: (order: Order) => void;\n /** Called when the order status changes during polling. */\n onStatusChange?: (previousStatus: OrderStatus, newStatus: OrderStatus, order: Order) => void;\n className?: string;\n classNames?: OrderSummaryClassNames;\n}\n\nconst STATUS_LABELS: Record<OrderStatus, string> = {\n pending: \"Pending\",\n created: \"Created\",\n confirmed: \"Confirmed\",\n in_preparation: \"In Preparation\",\n ready_to_serve: \"Ready\",\n partially_served: \"Partially Served\",\n served: \"Served\",\n delivered: \"Delivered\",\n picked_up: \"Picked Up\",\n completed: \"Completed\",\n cancelled: \"Cancelled\",\n};\n\nconst PAYMENT_STATE_LABELS: Record<PaymentState, string> = {\n not_paid: \"Not Paid\",\n partially_paid: \"Partially Paid\",\n paid: \"Paid\",\n partially_refunded: \"Partially Refunded\",\n refunded: \"Refunded\",\n};\n\n/**\n * OrderSummary — displays a single order's details, line items, and totals.\n *\n * Accepts either a pre-loaded `order` object or an `orderId` to fetch.\n * Supports polling for live status updates.\n */\nexport function OrderSummary({\n order: orderProp,\n orderId,\n poll = false,\n renderLineItem,\n onReorder,\n onStatusChange,\n className,\n classNames,\n}: OrderSummaryProps): React.ReactElement {\n const { order: fetched, isLoading } = useOrder(orderProp ? null : orderId, {\n enabled: !orderProp && !!orderId,\n poll,\n onStatusChange,\n });\n\n const order = orderProp ?? fetched;\n\n if (isLoading && !order) {\n return (\n <div\n data-cimplify-order-summary\n aria-busy=\"true\"\n className={cn(className, classNames?.root, classNames?.loading)}\n >\n <div data-cimplify-order-summary-skeleton />\n </div>\n );\n }\n\n if (!order) {\n return (\n <div data-cimplify-order-summary className={cn(className, classNames?.root)}>\n <p>Order not found.</p>\n </div>\n );\n }\n\n return (\n <div data-cimplify-order-summary className={cn(className, classNames?.root)}>\n {/* Header */}\n <div data-cimplify-order-header className={classNames?.header}>\n <span data-cimplify-order-id className={classNames?.orderId}>\n Order #{order.user_friendly_id}\n </span>\n <span\n data-cimplify-order-status\n data-status={order.status}\n className={classNames?.status}\n >\n {STATUS_LABELS[order.status] ?? order.status}\n </span>\n {order.payment_state && (\n <span\n data-cimplify-order-payment-state\n data-payment-state={order.payment_state}\n className={classNames?.paymentState}\n >\n {PAYMENT_STATE_LABELS[order.payment_state] ?? order.payment_state}\n </span>\n )}\n </div>\n\n {/* Fulfillment details */}\n {order.order_type === \"pickup\" && order.pickup_time && (\n <div data-cimplify-order-fulfillment className={classNames?.fulfillmentDetails}>\n <span>Pickup time: {new Date(order.pickup_time).toLocaleString()}</span>\n </div>\n )}\n {order.order_type === \"dine-in\" && order.table_number && (\n <div data-cimplify-order-fulfillment className={classNames?.fulfillmentDetails}>\n <span>Table: {order.table_number}</span>\n </div>\n )}\n\n {/* Date */}\n <time data-cimplify-order-date dateTime={order.created_at}>\n {new Date(order.created_at).toLocaleDateString(undefined, {\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n })}\n </time>\n\n {/* Customer info */}\n {(order.customer_name || order.customer_email) && (\n <div data-cimplify-order-customer className={classNames?.customer}>\n {order.customer_name && (\n <span data-cimplify-order-customer-name>{order.customer_name}</span>\n )}\n {order.customer_email && (\n <span data-cimplify-order-customer-email>{order.customer_email}</span>\n )}\n </div>\n )}\n\n {/* Delivery address */}\n {order.delivery_address && (\n <div data-cimplify-order-delivery-address className={classNames?.deliveryAddress}>\n <span>Delivery address</span>\n <p>{order.delivery_address}</p>\n </div>\n )}\n\n {/* Line items */}\n <div data-cimplify-order-items className={classNames?.items}>\n {order.items.map((item) =>\n renderLineItem ? (\n <React.Fragment key={item.id}>{renderLineItem(item)}</React.Fragment>\n ) : (\n <div key={item.id} data-cimplify-order-line-item className={classNames?.lineItem}>\n <div data-cimplify-order-line-info>\n <span data-cimplify-order-line-qty>{item.quantity}×</span>\n <span data-cimplify-order-line-key>{item.line_key}</span>\n </div>\n <Price amount={item.price} />\n {item.fulfillment_type === \"digital\" && item.fulfillment_id && (\n <a\n href={item.fulfillment_id}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-cimplify-order-line-download\n className=\"text-sm text-primary underline\"\n >\n Download\n </a>\n )}\n\n {/* Service items: show scheduling and confirmation details */}\n {item.configuration.type === \"service\" && (\n <div data-cimplify-order-service-info className={classNames?.serviceInfo}>\n {item.configuration.scheduled_start && (\n <span>{\"\\u{1F4C5}\"} {new Date(item.configuration.scheduled_start).toLocaleDateString()} at {new Date(item.configuration.scheduled_start).toLocaleTimeString([], { hour: \"2-digit\", minute: \"2-digit\" })}</span>\n )}\n {item.configuration.confirmation_code && (\n <span>Confirmation: {item.configuration.confirmation_code}</span>\n )}\n {item.configuration.service_status && (\n <span data-status={item.configuration.service_status}>{item.configuration.service_status}</span>\n )}\n </div>\n )}\n\n {/* Digital items: instant delivery badge */}\n {item.configuration.type === \"digital\" && (\n <div data-cimplify-order-digital-info className={classNames?.digitalInfo}>\n <span>{\"\\u26A1\"} Instant digital delivery</span>\n </div>\n )}\n\n {/* Bundle items: component breakdown */}\n {item.configuration.type === \"bundle\" && item.configuration.resolved && (\n <div data-cimplify-order-bundle-breakdown className={classNames?.bundleBreakdown}>\n {item.configuration.resolved.selections.map((sel) => (\n <div key={sel.component_id} data-product-type={sel.product_type}>\n <span>{sel.quantity}× {sel.product_name}</span>\n {sel.product_type === \"service\" && sel.scheduling?.scheduled_start && (\n <span> — {new Date(sel.scheduling.scheduled_start).toLocaleDateString()}</span>\n )}\n {sel.product_type === \"digital\" && <span> — Digital</span>}\n </div>\n ))}\n </div>\n )}\n\n {/* Composite items: component breakdown with pricing */}\n {item.configuration.type === \"composite\" && item.configuration.resolved && (\n <div data-cimplify-order-composite-breakdown className={classNames?.compositeBreakdown}>\n {item.configuration.resolved.selections.map((sel) => (\n <div key={sel.component_id} data-product-type={sel.product_type}>\n <span>{sel.quantity}× {sel.component_name}</span>\n {sel.product_type === \"service\" && sel.scheduling?.scheduled_start && (\n <span> — {new Date(sel.scheduling.scheduled_start).toLocaleDateString()}</span>\n )}\n <Price amount={sel.unit_price} />\n </div>\n ))}\n </div>\n )}\n </div>\n ),\n )}\n </div>\n\n {/* Customer notes / special instructions */}\n {order.customer_notes && order.customer_notes.length > 0 && (\n <div data-cimplify-order-notes className={classNames?.notes}>\n <span>Notes</span>\n {order.customer_notes.map((note, index) => (\n <p key={index} data-cimplify-order-note>{note}</p>\n ))}\n </div>\n )}\n\n {/* Totals */}\n <div data-cimplify-order-totals className={classNames?.totals}>\n {order.total_discount != null && parsePrice(order.total_discount) !== 0 && (\n <div data-cimplify-order-discount>\n <span>Discount</span>\n <Price amount={order.total_discount} prefix=\"-\" />\n </div>\n )}\n {order.delivery_fee != null && parsePrice(order.delivery_fee) > 0 && (\n <div data-cimplify-order-delivery-fee>\n <span>Delivery fee</span>\n <Price amount={order.delivery_fee} />\n </div>\n )}\n {order.service_charge != null && parsePrice(order.service_charge) !== 0 && (\n <div data-cimplify-order-service-charge>\n <span>Service charge</span>\n <Price amount={order.service_charge} />\n </div>\n )}\n {order.tax != null && parsePrice(order.tax) !== 0 && (\n <div data-cimplify-order-tax>\n <span>Tax</span>\n <Price amount={order.tax} />\n </div>\n )}\n <div data-cimplify-order-total>\n <span>Total</span>\n <Price amount={order.total_price} />\n </div>\n </div>\n\n {/* Tracking */}\n {order.tracking_link && (\n <a\n href={order.tracking_link}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-cimplify-order-tracking\n className={classNames?.trackingLink}\n >\n Track your order\n </a>\n )}\n\n {onReorder && (\n <button\n type=\"button\"\n onClick={() => onReorder(order)}\n data-cimplify-order-reorder\n className={classNames?.reorderButton}\n >\n Reorder\n </button>\n )}\n </div>\n );\n}\n"
|
|
14
14
|
}
|
|
15
15
|
]
|
|
16
16
|
}
|
package/dist/link-D9iSVxt5.d.mts
DELETED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
declare const CHECKOUT_MODE: {
|
|
2
|
-
readonly LINK: "link";
|
|
3
|
-
readonly GUEST: "guest";
|
|
4
|
-
};
|
|
5
|
-
declare const ORDER_TYPE: {
|
|
6
|
-
readonly DELIVERY: "delivery";
|
|
7
|
-
readonly PICKUP: "pickup";
|
|
8
|
-
readonly DINE_IN: "dine-in";
|
|
9
|
-
readonly WALK_IN: "walk-in";
|
|
10
|
-
};
|
|
11
|
-
declare const PAYMENT_METHOD: {
|
|
12
|
-
readonly MOBILE_MONEY: "mobile_money";
|
|
13
|
-
readonly CARD: "card";
|
|
14
|
-
};
|
|
15
|
-
declare const CHECKOUT_STEP: {
|
|
16
|
-
readonly AUTHENTICATION: "authentication";
|
|
17
|
-
readonly ORDER_DETAILS: "order_details";
|
|
18
|
-
readonly PAYMENT_METHOD: "payment_method";
|
|
19
|
-
readonly PAYMENT: "payment";
|
|
20
|
-
readonly CONFIRMATION: "confirmation";
|
|
21
|
-
};
|
|
22
|
-
declare const PAYMENT_STATE: {
|
|
23
|
-
readonly INITIAL: "initial";
|
|
24
|
-
readonly PREPARING: "preparing";
|
|
25
|
-
readonly PROCESSING: "processing";
|
|
26
|
-
readonly VERIFYING: "verifying";
|
|
27
|
-
readonly AWAITING_AUTHORIZATION: "awaiting_authorization";
|
|
28
|
-
readonly SUCCESS: "success";
|
|
29
|
-
readonly ERROR: "error";
|
|
30
|
-
readonly TIMEOUT: "timeout";
|
|
31
|
-
};
|
|
32
|
-
declare const PICKUP_TIME_TYPE: {
|
|
33
|
-
readonly ASAP: "asap";
|
|
34
|
-
readonly SCHEDULED: "scheduled";
|
|
35
|
-
};
|
|
36
|
-
declare const MOBILE_MONEY_PROVIDER: {
|
|
37
|
-
readonly MTN: "mtn";
|
|
38
|
-
readonly VODAFONE: "vodafone";
|
|
39
|
-
readonly TELECEL: "telecel";
|
|
40
|
-
readonly AIRTEL: "airtel";
|
|
41
|
-
readonly AIRTELTIGO: "airteltigo";
|
|
42
|
-
readonly MPESA: "mpesa";
|
|
43
|
-
};
|
|
44
|
-
declare const AUTHORIZATION_TYPE: {
|
|
45
|
-
readonly OTP: "otp";
|
|
46
|
-
readonly PIN: "pin";
|
|
47
|
-
readonly PHONE: "phone";
|
|
48
|
-
readonly BIRTHDAY: "birthday";
|
|
49
|
-
readonly ADDRESS: "address";
|
|
50
|
-
};
|
|
51
|
-
/** Hard stop for provider-controlled sequential checkout challenges. */
|
|
52
|
-
declare const MAX_PAYMENT_AUTHORIZATION_STEPS = 8;
|
|
53
|
-
declare const DEVICE_TYPE: {
|
|
54
|
-
readonly MOBILE: "mobile";
|
|
55
|
-
readonly DESKTOP: "desktop";
|
|
56
|
-
readonly TABLET: "tablet";
|
|
57
|
-
readonly UNKNOWN: "unknown";
|
|
58
|
-
};
|
|
59
|
-
declare const CONTACT_TYPE: {
|
|
60
|
-
readonly PHONE: "phone";
|
|
61
|
-
readonly EMAIL: "email";
|
|
62
|
-
};
|
|
63
|
-
declare const LINK_QUERY: {
|
|
64
|
-
readonly DATA: "link.data";
|
|
65
|
-
readonly ADDRESSES: "link.addresses";
|
|
66
|
-
readonly MOBILE_MONEY: "link.mobile_money";
|
|
67
|
-
readonly PREFERENCES: "link.preferences";
|
|
68
|
-
readonly SESSIONS: "link.sessions";
|
|
69
|
-
};
|
|
70
|
-
declare const LINK_MUTATION: {
|
|
71
|
-
readonly CHECK_STATUS: "link.check_status";
|
|
72
|
-
readonly ENROLL: "link.enroll";
|
|
73
|
-
readonly ENROLL_AND_LINK_ORDER: "link.enroll_and_link_order";
|
|
74
|
-
readonly UPDATE_PREFERENCES: "link.update_preferences";
|
|
75
|
-
readonly CREATE_ADDRESS: "link.create_address";
|
|
76
|
-
readonly UPDATE_ADDRESS: "link.update_address";
|
|
77
|
-
readonly DELETE_ADDRESS: "link.delete_address";
|
|
78
|
-
readonly SET_DEFAULT_ADDRESS: "link.set_default_address";
|
|
79
|
-
readonly TRACK_ADDRESS_USAGE: "link.track_address_usage";
|
|
80
|
-
readonly CREATE_MOBILE_MONEY: "link.create_mobile_money";
|
|
81
|
-
readonly DELETE_MOBILE_MONEY: "link.delete_mobile_money";
|
|
82
|
-
readonly SET_DEFAULT_MOBILE_MONEY: "link.set_default_mobile_money";
|
|
83
|
-
readonly TRACK_MOBILE_MONEY_USAGE: "link.track_mobile_money_usage";
|
|
84
|
-
readonly VERIFY_MOBILE_MONEY: "link.verify_mobile_money";
|
|
85
|
-
readonly REVOKE_SESSION: "link.revoke_session";
|
|
86
|
-
readonly REVOKE_ALL_SESSIONS: "link.revoke_all_sessions";
|
|
87
|
-
};
|
|
88
|
-
declare const AUTH_MUTATION: {
|
|
89
|
-
readonly REQUEST_OTP: "auth.request_otp";
|
|
90
|
-
readonly VERIFY_OTP: "auth.verify_otp";
|
|
91
|
-
};
|
|
92
|
-
declare const CHECKOUT_MUTATION: {
|
|
93
|
-
readonly PROCESS: "checkout.process";
|
|
94
|
-
};
|
|
95
|
-
declare const PAYMENT_MUTATION: {
|
|
96
|
-
readonly SUBMIT_AUTHORIZATION: "payment.submit_authorization";
|
|
97
|
-
readonly CHECK_STATUS: "order.poll_payment_status";
|
|
98
|
-
};
|
|
99
|
-
declare const ORDER_MUTATION: {
|
|
100
|
-
readonly UPDATE_CUSTOMER: "order.update_order_customer";
|
|
101
|
-
};
|
|
102
|
-
declare const DEFAULT_CURRENCY = "GHS";
|
|
103
|
-
declare const DEFAULT_COUNTRY = "GHA";
|
|
104
|
-
|
|
105
|
-
type MobileMoneyProvider = (typeof MOBILE_MONEY_PROVIDER)[keyof typeof MOBILE_MONEY_PROVIDER];
|
|
106
|
-
interface Customer {
|
|
107
|
-
id: string;
|
|
108
|
-
email: string | null;
|
|
109
|
-
phone: string | null;
|
|
110
|
-
name: string;
|
|
111
|
-
delivery_address: string | null;
|
|
112
|
-
created_at: string;
|
|
113
|
-
updated_at: string;
|
|
114
|
-
metadata?: Record<string, unknown> | null;
|
|
115
|
-
account_id?: string | null;
|
|
116
|
-
}
|
|
117
|
-
interface CustomerAddress {
|
|
118
|
-
id: string;
|
|
119
|
-
customer_id: string;
|
|
120
|
-
label: string;
|
|
121
|
-
street_address: string;
|
|
122
|
-
apartment: string | null;
|
|
123
|
-
city: string;
|
|
124
|
-
region: string;
|
|
125
|
-
postal_code: string | null;
|
|
126
|
-
country: string | null;
|
|
127
|
-
delivery_instructions: string | null;
|
|
128
|
-
phone_for_delivery: string | null;
|
|
129
|
-
latitude: number | null;
|
|
130
|
-
longitude: number | null;
|
|
131
|
-
is_default: boolean | null;
|
|
132
|
-
usage_count: number | null;
|
|
133
|
-
last_used_at: string | null;
|
|
134
|
-
created_at: string;
|
|
135
|
-
updated_at: string;
|
|
136
|
-
}
|
|
137
|
-
interface CustomerMobileMoney {
|
|
138
|
-
id: string;
|
|
139
|
-
customer_id: string;
|
|
140
|
-
phone_number: string;
|
|
141
|
-
provider: string;
|
|
142
|
-
label: string;
|
|
143
|
-
is_verified: boolean | null;
|
|
144
|
-
verification_date: string | null;
|
|
145
|
-
is_default: boolean | null;
|
|
146
|
-
usage_count: number | null;
|
|
147
|
-
last_used_at: string | null;
|
|
148
|
-
success_rate: number | null;
|
|
149
|
-
created_at: string;
|
|
150
|
-
updated_at: string;
|
|
151
|
-
}
|
|
152
|
-
interface CustomerLinkPreferences {
|
|
153
|
-
customer_id: string;
|
|
154
|
-
is_link_enabled: boolean | null;
|
|
155
|
-
enrolled_at: string | null;
|
|
156
|
-
enrollment_business_id: string | null;
|
|
157
|
-
preferred_order_type: string | null;
|
|
158
|
-
default_address_id: string | null;
|
|
159
|
-
default_mobile_money_id: string | null;
|
|
160
|
-
remember_me: boolean | null;
|
|
161
|
-
session_duration_days: number | null;
|
|
162
|
-
two_factor_enabled: boolean | null;
|
|
163
|
-
notify_on_order: boolean | null;
|
|
164
|
-
notify_on_payment: boolean | null;
|
|
165
|
-
created_at: string;
|
|
166
|
-
updated_at: string;
|
|
167
|
-
}
|
|
168
|
-
interface LinkData {
|
|
169
|
-
customer: Customer;
|
|
170
|
-
addresses: CustomerAddress[];
|
|
171
|
-
mobile_money: CustomerMobileMoney[];
|
|
172
|
-
preferences: CustomerLinkPreferences;
|
|
173
|
-
default_address: CustomerAddress | null;
|
|
174
|
-
default_mobile_money: CustomerMobileMoney | null;
|
|
175
|
-
}
|
|
176
|
-
interface CreateAddressInput {
|
|
177
|
-
label?: string;
|
|
178
|
-
street_address: string;
|
|
179
|
-
apartment?: string;
|
|
180
|
-
city: string;
|
|
181
|
-
region?: string;
|
|
182
|
-
postal_code?: string;
|
|
183
|
-
country?: string;
|
|
184
|
-
delivery_instructions?: string;
|
|
185
|
-
phone_for_delivery?: string;
|
|
186
|
-
latitude?: number;
|
|
187
|
-
longitude?: number;
|
|
188
|
-
}
|
|
189
|
-
interface UpdateAddressInput {
|
|
190
|
-
address_id: string;
|
|
191
|
-
label?: string;
|
|
192
|
-
street_address?: string;
|
|
193
|
-
apartment?: string;
|
|
194
|
-
city?: string;
|
|
195
|
-
region?: string;
|
|
196
|
-
postal_code?: string;
|
|
197
|
-
country?: string;
|
|
198
|
-
delivery_instructions?: string;
|
|
199
|
-
phone_for_delivery?: string;
|
|
200
|
-
latitude?: number;
|
|
201
|
-
longitude?: number;
|
|
202
|
-
clear_coordinates?: boolean;
|
|
203
|
-
}
|
|
204
|
-
interface CreateMobileMoneyInput {
|
|
205
|
-
phone_number: string;
|
|
206
|
-
provider: MobileMoneyProvider;
|
|
207
|
-
label?: string;
|
|
208
|
-
}
|
|
209
|
-
interface EnrollmentData {
|
|
210
|
-
contact: string;
|
|
211
|
-
name?: string;
|
|
212
|
-
}
|
|
213
|
-
interface AddressData {
|
|
214
|
-
label: string;
|
|
215
|
-
street_address: string;
|
|
216
|
-
apartment?: string;
|
|
217
|
-
city: string;
|
|
218
|
-
region: string;
|
|
219
|
-
postal_code?: string;
|
|
220
|
-
country?: string;
|
|
221
|
-
delivery_instructions?: string;
|
|
222
|
-
phone_for_delivery?: string;
|
|
223
|
-
latitude?: number;
|
|
224
|
-
longitude?: number;
|
|
225
|
-
}
|
|
226
|
-
interface MobileMoneyData {
|
|
227
|
-
phone_number: string;
|
|
228
|
-
provider: string;
|
|
229
|
-
label: string;
|
|
230
|
-
}
|
|
231
|
-
interface EnrollAndLinkOrderInput {
|
|
232
|
-
order_id: string;
|
|
233
|
-
business_id: string;
|
|
234
|
-
address?: AddressData;
|
|
235
|
-
mobile_money?: MobileMoneyData;
|
|
236
|
-
order_type?: string;
|
|
237
|
-
}
|
|
238
|
-
interface LinkStatusResult {
|
|
239
|
-
is_link_customer: boolean;
|
|
240
|
-
}
|
|
241
|
-
interface LinkEnrollResult {
|
|
242
|
-
success: boolean;
|
|
243
|
-
customer_id: string;
|
|
244
|
-
contact?: string;
|
|
245
|
-
enrolled_at?: string;
|
|
246
|
-
preferences?: CustomerLinkPreferences;
|
|
247
|
-
}
|
|
248
|
-
interface EnrollAndLinkOrderResult {
|
|
249
|
-
success: boolean;
|
|
250
|
-
customer_id: string;
|
|
251
|
-
order_id: string;
|
|
252
|
-
enrollment_result: unknown;
|
|
253
|
-
linked_at: string;
|
|
254
|
-
}
|
|
255
|
-
type DeviceType = (typeof DEVICE_TYPE)[keyof typeof DEVICE_TYPE];
|
|
256
|
-
interface LinkSession {
|
|
257
|
-
id: string;
|
|
258
|
-
device_name: string | null;
|
|
259
|
-
device_type: DeviceType | null;
|
|
260
|
-
ip_address: string | null;
|
|
261
|
-
last_used_at: string | null;
|
|
262
|
-
created_at: string;
|
|
263
|
-
is_current: boolean;
|
|
264
|
-
}
|
|
265
|
-
interface RevokeSessionResult {
|
|
266
|
-
success: boolean;
|
|
267
|
-
session_id: string;
|
|
268
|
-
message: string;
|
|
269
|
-
}
|
|
270
|
-
interface RevokeAllSessionsResult {
|
|
271
|
-
success: boolean;
|
|
272
|
-
revoked_count: number;
|
|
273
|
-
message: string;
|
|
274
|
-
}
|
|
275
|
-
type ContactType = (typeof CONTACT_TYPE)[keyof typeof CONTACT_TYPE];
|
|
276
|
-
interface RequestOtpInput {
|
|
277
|
-
contact: string;
|
|
278
|
-
contact_type: ContactType;
|
|
279
|
-
}
|
|
280
|
-
interface RequestOtpResult {
|
|
281
|
-
success: boolean;
|
|
282
|
-
/** Absent on pre-challenge-id deployments; verification then uses the
|
|
283
|
-
* contact's legacy active challenge. */
|
|
284
|
-
challenge_id?: string;
|
|
285
|
-
message: string;
|
|
286
|
-
expires_in: number;
|
|
287
|
-
is_new_account: boolean;
|
|
288
|
-
}
|
|
289
|
-
interface VerifyOtpInput {
|
|
290
|
-
/** Omit when request-otp came from a legacy deployment without an id. */
|
|
291
|
-
challenge_id?: string;
|
|
292
|
-
contact: string;
|
|
293
|
-
contact_type: ContactType;
|
|
294
|
-
otp_code: string;
|
|
295
|
-
}
|
|
296
|
-
interface AuthResponse {
|
|
297
|
-
success: boolean;
|
|
298
|
-
session_token: string | null;
|
|
299
|
-
refresh_token?: string | null;
|
|
300
|
-
account_id?: string | null;
|
|
301
|
-
customer_id: string | null;
|
|
302
|
-
name?: string | null;
|
|
303
|
-
email?: string | null;
|
|
304
|
-
phone?: string | null;
|
|
305
|
-
message: string;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
export { AUTHORIZATION_TYPE as A, ORDER_TYPE as B, CHECKOUT_MODE as C, DEFAULT_COUNTRY as D, type EnrollAndLinkOrderInput as E, PAYMENT_MUTATION as F, PAYMENT_STATE as G, PICKUP_TIME_TYPE as H, type RequestOtpResult as I, type RevokeAllSessionsResult as J, type RevokeSessionResult as K, LINK_MUTATION as L, MAX_PAYMENT_AUTHORIZATION_STEPS as M, ORDER_MUTATION as O, PAYMENT_METHOD as P, type RequestOtpInput as R, type UpdateAddressInput as U, type VerifyOtpInput as V, AUTH_MUTATION as a, type AddressData as b, type AuthResponse as c, CHECKOUT_MUTATION as d, CHECKOUT_STEP as e, CONTACT_TYPE as f, type ContactType as g, type CreateAddressInput as h, type CreateMobileMoneyInput as i, type Customer as j, type CustomerAddress as k, type CustomerLinkPreferences as l, type CustomerMobileMoney as m, DEFAULT_CURRENCY as n, DEVICE_TYPE as o, type DeviceType as p, type EnrollAndLinkOrderResult as q, type EnrollmentData as r, LINK_QUERY as s, type LinkData as t, type LinkEnrollResult as u, type LinkSession as v, type LinkStatusResult as w, MOBILE_MONEY_PROVIDER as x, type MobileMoneyData as y, type MobileMoneyProvider as z };
|