@cimplify/sdk 0.8.5 → 0.8.7
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 +113 -1
- package/dist/advanced.mjs +113 -1
- package/dist/{client-iRG2DBq0.d.mts → client-6MsOWo8f.d.mts} +19 -1
- package/dist/{client-8SahVQEy.d.ts → client-CVJ0S99a.d.ts} +19 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +113 -1
- package/dist/index.mjs +113 -1
- package/dist/react.d.mts +28 -2
- package/dist/react.d.ts +28 -2
- package/dist/react.js +309 -17
- package/dist/react.mjs +309 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1339,6 +1339,10 @@ var DEFAULT_POLL_INTERVAL_MS = 3e3;
|
|
|
1339
1339
|
var DEFAULT_MAX_POLL_ATTEMPTS = 60;
|
|
1340
1340
|
var MAX_CONSECUTIVE_NETWORK_ERRORS = 5;
|
|
1341
1341
|
var CARD_PROVIDER_PAYSTACK = "paystack";
|
|
1342
|
+
var NEXT_ACTION_NONE = "none";
|
|
1343
|
+
var NEXT_ACTION_CARD_POPUP = "card_popup";
|
|
1344
|
+
var NEXT_ACTION_REDIRECT = "redirect";
|
|
1345
|
+
var NEXT_ACTION_AUTHORIZATION = "authorization";
|
|
1342
1346
|
function normalizeCardPopupError(error) {
|
|
1343
1347
|
if (!error || error === "PAYMENT_CANCELLED" || error === "CANCELLED") {
|
|
1344
1348
|
return "PAYMENT_CANCELLED";
|
|
@@ -1378,7 +1382,8 @@ function isValidMobileMoneyProvider(value) {
|
|
|
1378
1382
|
return VALID_MOBILE_MONEY_PROVIDERS.has(value);
|
|
1379
1383
|
}
|
|
1380
1384
|
function normalizeAuthorizationType(value) {
|
|
1381
|
-
|
|
1385
|
+
const lower = value?.toLowerCase();
|
|
1386
|
+
return lower === "otp" || lower === "pin" ? lower : void 0;
|
|
1382
1387
|
}
|
|
1383
1388
|
function formatMoney2(value) {
|
|
1384
1389
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
@@ -1425,6 +1430,9 @@ var CheckoutResolver = class {
|
|
|
1425
1430
|
if (!checkoutResult.order_id) {
|
|
1426
1431
|
return this.fail("CHECKOUT_FAILED", "Checkout did not return an order ID.", false);
|
|
1427
1432
|
}
|
|
1433
|
+
if (checkoutResult.next_action) {
|
|
1434
|
+
return this.resolveNextAction(checkoutResult);
|
|
1435
|
+
}
|
|
1428
1436
|
let latestCheckoutResult = checkoutResult;
|
|
1429
1437
|
let authorizationType = normalizeAuthorizationType(checkoutResult.authorization_type);
|
|
1430
1438
|
let paymentReference = checkoutResult.payment_reference;
|
|
@@ -1540,6 +1548,110 @@ var CheckoutResolver = class {
|
|
|
1540
1548
|
return this.fail("CHECKOUT_FAILED", message, true);
|
|
1541
1549
|
}
|
|
1542
1550
|
}
|
|
1551
|
+
async resolveNextAction(checkoutResult) {
|
|
1552
|
+
const action = checkoutResult.next_action;
|
|
1553
|
+
if (this.isSuccessfulStatus(checkoutResult.payment_status)) {
|
|
1554
|
+
return this.finalizeSuccess(checkoutResult);
|
|
1555
|
+
}
|
|
1556
|
+
let latestCheckoutResult = checkoutResult;
|
|
1557
|
+
let paymentReference = checkoutResult.payment_reference;
|
|
1558
|
+
switch (action.type) {
|
|
1559
|
+
case NEXT_ACTION_NONE:
|
|
1560
|
+
return this.finalizeSuccess(checkoutResult);
|
|
1561
|
+
case NEXT_ACTION_CARD_POPUP: {
|
|
1562
|
+
const provider = normalizeCardProvider(action.provider);
|
|
1563
|
+
this.emit("awaiting_authorization", {
|
|
1564
|
+
display_text: "Complete payment in the card authorization popup.",
|
|
1565
|
+
order_id: checkoutResult.order_id,
|
|
1566
|
+
order_number: checkoutResult.order_number
|
|
1567
|
+
});
|
|
1568
|
+
if (!this.allowPopups) {
|
|
1569
|
+
return this.fail(
|
|
1570
|
+
"PROVIDER_UNAVAILABLE",
|
|
1571
|
+
"Card payment popup is unavailable in this environment.",
|
|
1572
|
+
false
|
|
1573
|
+
);
|
|
1574
|
+
}
|
|
1575
|
+
const popupResult = await openCardPopup(
|
|
1576
|
+
provider,
|
|
1577
|
+
checkoutResult,
|
|
1578
|
+
this.checkoutData.customer.email || "customer@cimplify.io",
|
|
1579
|
+
this.getOrderCurrency(checkoutResult),
|
|
1580
|
+
this.signal
|
|
1581
|
+
);
|
|
1582
|
+
if (!popupResult.success) {
|
|
1583
|
+
const popupError = normalizeCardPopupError(popupResult.error);
|
|
1584
|
+
if (popupError === "POPUP_BLOCKED") {
|
|
1585
|
+
return this.fail(
|
|
1586
|
+
"POPUP_BLOCKED",
|
|
1587
|
+
"Unable to open card payment popup. Please allow popups and try again.",
|
|
1588
|
+
true
|
|
1589
|
+
);
|
|
1590
|
+
}
|
|
1591
|
+
if (popupError === "PROVIDER_UNAVAILABLE") {
|
|
1592
|
+
return this.fail("PROVIDER_UNAVAILABLE", "Card payment provider is unavailable.", false);
|
|
1593
|
+
}
|
|
1594
|
+
return this.fail("PAYMENT_CANCELLED", "Card payment was cancelled before completion.", true);
|
|
1595
|
+
}
|
|
1596
|
+
paymentReference = popupResult.reference || paymentReference;
|
|
1597
|
+
break;
|
|
1598
|
+
}
|
|
1599
|
+
case NEXT_ACTION_REDIRECT: {
|
|
1600
|
+
if (typeof window !== "undefined" && this.returnUrl) {
|
|
1601
|
+
window.location.assign(action.authorization_url);
|
|
1602
|
+
return this.fail("REDIRECT_REQUIRED", "Redirecting to complete payment authorization.", true);
|
|
1603
|
+
}
|
|
1604
|
+
if (typeof window !== "undefined") {
|
|
1605
|
+
const popup = window.open(
|
|
1606
|
+
action.authorization_url,
|
|
1607
|
+
"cimplify-auth",
|
|
1608
|
+
"width=520,height=760,noopener,noreferrer"
|
|
1609
|
+
);
|
|
1610
|
+
if (!popup) {
|
|
1611
|
+
return this.fail(
|
|
1612
|
+
"POPUP_BLOCKED",
|
|
1613
|
+
"Authorization popup was blocked. Please allow popups and retry.",
|
|
1614
|
+
true
|
|
1615
|
+
);
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
break;
|
|
1619
|
+
}
|
|
1620
|
+
case NEXT_ACTION_AUTHORIZATION: {
|
|
1621
|
+
const authType = normalizeAuthorizationType(action.authorization_type);
|
|
1622
|
+
const authorization = await this.handleAuthorization({
|
|
1623
|
+
authorizationType: authType,
|
|
1624
|
+
paymentReference,
|
|
1625
|
+
displayText: action.display_text,
|
|
1626
|
+
provider: checkoutResult.provider
|
|
1627
|
+
});
|
|
1628
|
+
if (!authorization.ok) {
|
|
1629
|
+
return authorization.result;
|
|
1630
|
+
}
|
|
1631
|
+
if (authorization.value) {
|
|
1632
|
+
latestCheckoutResult = authorization.value;
|
|
1633
|
+
paymentReference = authorization.value.payment_reference || paymentReference;
|
|
1634
|
+
if (this.isSuccessfulStatus(authorization.value.payment_status)) {
|
|
1635
|
+
return this.finalizeSuccess(authorization.value);
|
|
1636
|
+
}
|
|
1637
|
+
if (this.isFailureStatus(authorization.value.payment_status)) {
|
|
1638
|
+
return this.fail(
|
|
1639
|
+
"AUTHORIZATION_FAILED",
|
|
1640
|
+
authorization.value.display_text || "Payment authorization failed.",
|
|
1641
|
+
false
|
|
1642
|
+
);
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
break;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
return this.pollUntilTerminal({
|
|
1649
|
+
orderId: checkoutResult.order_id,
|
|
1650
|
+
latestCheckoutResult,
|
|
1651
|
+
paymentReference,
|
|
1652
|
+
authorizationType: normalizeAuthorizationType(checkoutResult.authorization_type)
|
|
1653
|
+
});
|
|
1654
|
+
}
|
|
1543
1655
|
async pollUntilTerminal(input) {
|
|
1544
1656
|
let consecutiveErrors = 0;
|
|
1545
1657
|
let latestCheckoutResult = input.latestCheckoutResult;
|
package/dist/index.mjs
CHANGED
|
@@ -1337,6 +1337,10 @@ var DEFAULT_POLL_INTERVAL_MS = 3e3;
|
|
|
1337
1337
|
var DEFAULT_MAX_POLL_ATTEMPTS = 60;
|
|
1338
1338
|
var MAX_CONSECUTIVE_NETWORK_ERRORS = 5;
|
|
1339
1339
|
var CARD_PROVIDER_PAYSTACK = "paystack";
|
|
1340
|
+
var NEXT_ACTION_NONE = "none";
|
|
1341
|
+
var NEXT_ACTION_CARD_POPUP = "card_popup";
|
|
1342
|
+
var NEXT_ACTION_REDIRECT = "redirect";
|
|
1343
|
+
var NEXT_ACTION_AUTHORIZATION = "authorization";
|
|
1340
1344
|
function normalizeCardPopupError(error) {
|
|
1341
1345
|
if (!error || error === "PAYMENT_CANCELLED" || error === "CANCELLED") {
|
|
1342
1346
|
return "PAYMENT_CANCELLED";
|
|
@@ -1376,7 +1380,8 @@ function isValidMobileMoneyProvider(value) {
|
|
|
1376
1380
|
return VALID_MOBILE_MONEY_PROVIDERS.has(value);
|
|
1377
1381
|
}
|
|
1378
1382
|
function normalizeAuthorizationType(value) {
|
|
1379
|
-
|
|
1383
|
+
const lower = value?.toLowerCase();
|
|
1384
|
+
return lower === "otp" || lower === "pin" ? lower : void 0;
|
|
1380
1385
|
}
|
|
1381
1386
|
function formatMoney2(value) {
|
|
1382
1387
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
@@ -1423,6 +1428,9 @@ var CheckoutResolver = class {
|
|
|
1423
1428
|
if (!checkoutResult.order_id) {
|
|
1424
1429
|
return this.fail("CHECKOUT_FAILED", "Checkout did not return an order ID.", false);
|
|
1425
1430
|
}
|
|
1431
|
+
if (checkoutResult.next_action) {
|
|
1432
|
+
return this.resolveNextAction(checkoutResult);
|
|
1433
|
+
}
|
|
1426
1434
|
let latestCheckoutResult = checkoutResult;
|
|
1427
1435
|
let authorizationType = normalizeAuthorizationType(checkoutResult.authorization_type);
|
|
1428
1436
|
let paymentReference = checkoutResult.payment_reference;
|
|
@@ -1538,6 +1546,110 @@ var CheckoutResolver = class {
|
|
|
1538
1546
|
return this.fail("CHECKOUT_FAILED", message, true);
|
|
1539
1547
|
}
|
|
1540
1548
|
}
|
|
1549
|
+
async resolveNextAction(checkoutResult) {
|
|
1550
|
+
const action = checkoutResult.next_action;
|
|
1551
|
+
if (this.isSuccessfulStatus(checkoutResult.payment_status)) {
|
|
1552
|
+
return this.finalizeSuccess(checkoutResult);
|
|
1553
|
+
}
|
|
1554
|
+
let latestCheckoutResult = checkoutResult;
|
|
1555
|
+
let paymentReference = checkoutResult.payment_reference;
|
|
1556
|
+
switch (action.type) {
|
|
1557
|
+
case NEXT_ACTION_NONE:
|
|
1558
|
+
return this.finalizeSuccess(checkoutResult);
|
|
1559
|
+
case NEXT_ACTION_CARD_POPUP: {
|
|
1560
|
+
const provider = normalizeCardProvider(action.provider);
|
|
1561
|
+
this.emit("awaiting_authorization", {
|
|
1562
|
+
display_text: "Complete payment in the card authorization popup.",
|
|
1563
|
+
order_id: checkoutResult.order_id,
|
|
1564
|
+
order_number: checkoutResult.order_number
|
|
1565
|
+
});
|
|
1566
|
+
if (!this.allowPopups) {
|
|
1567
|
+
return this.fail(
|
|
1568
|
+
"PROVIDER_UNAVAILABLE",
|
|
1569
|
+
"Card payment popup is unavailable in this environment.",
|
|
1570
|
+
false
|
|
1571
|
+
);
|
|
1572
|
+
}
|
|
1573
|
+
const popupResult = await openCardPopup(
|
|
1574
|
+
provider,
|
|
1575
|
+
checkoutResult,
|
|
1576
|
+
this.checkoutData.customer.email || "customer@cimplify.io",
|
|
1577
|
+
this.getOrderCurrency(checkoutResult),
|
|
1578
|
+
this.signal
|
|
1579
|
+
);
|
|
1580
|
+
if (!popupResult.success) {
|
|
1581
|
+
const popupError = normalizeCardPopupError(popupResult.error);
|
|
1582
|
+
if (popupError === "POPUP_BLOCKED") {
|
|
1583
|
+
return this.fail(
|
|
1584
|
+
"POPUP_BLOCKED",
|
|
1585
|
+
"Unable to open card payment popup. Please allow popups and try again.",
|
|
1586
|
+
true
|
|
1587
|
+
);
|
|
1588
|
+
}
|
|
1589
|
+
if (popupError === "PROVIDER_UNAVAILABLE") {
|
|
1590
|
+
return this.fail("PROVIDER_UNAVAILABLE", "Card payment provider is unavailable.", false);
|
|
1591
|
+
}
|
|
1592
|
+
return this.fail("PAYMENT_CANCELLED", "Card payment was cancelled before completion.", true);
|
|
1593
|
+
}
|
|
1594
|
+
paymentReference = popupResult.reference || paymentReference;
|
|
1595
|
+
break;
|
|
1596
|
+
}
|
|
1597
|
+
case NEXT_ACTION_REDIRECT: {
|
|
1598
|
+
if (typeof window !== "undefined" && this.returnUrl) {
|
|
1599
|
+
window.location.assign(action.authorization_url);
|
|
1600
|
+
return this.fail("REDIRECT_REQUIRED", "Redirecting to complete payment authorization.", true);
|
|
1601
|
+
}
|
|
1602
|
+
if (typeof window !== "undefined") {
|
|
1603
|
+
const popup = window.open(
|
|
1604
|
+
action.authorization_url,
|
|
1605
|
+
"cimplify-auth",
|
|
1606
|
+
"width=520,height=760,noopener,noreferrer"
|
|
1607
|
+
);
|
|
1608
|
+
if (!popup) {
|
|
1609
|
+
return this.fail(
|
|
1610
|
+
"POPUP_BLOCKED",
|
|
1611
|
+
"Authorization popup was blocked. Please allow popups and retry.",
|
|
1612
|
+
true
|
|
1613
|
+
);
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
break;
|
|
1617
|
+
}
|
|
1618
|
+
case NEXT_ACTION_AUTHORIZATION: {
|
|
1619
|
+
const authType = normalizeAuthorizationType(action.authorization_type);
|
|
1620
|
+
const authorization = await this.handleAuthorization({
|
|
1621
|
+
authorizationType: authType,
|
|
1622
|
+
paymentReference,
|
|
1623
|
+
displayText: action.display_text,
|
|
1624
|
+
provider: checkoutResult.provider
|
|
1625
|
+
});
|
|
1626
|
+
if (!authorization.ok) {
|
|
1627
|
+
return authorization.result;
|
|
1628
|
+
}
|
|
1629
|
+
if (authorization.value) {
|
|
1630
|
+
latestCheckoutResult = authorization.value;
|
|
1631
|
+
paymentReference = authorization.value.payment_reference || paymentReference;
|
|
1632
|
+
if (this.isSuccessfulStatus(authorization.value.payment_status)) {
|
|
1633
|
+
return this.finalizeSuccess(authorization.value);
|
|
1634
|
+
}
|
|
1635
|
+
if (this.isFailureStatus(authorization.value.payment_status)) {
|
|
1636
|
+
return this.fail(
|
|
1637
|
+
"AUTHORIZATION_FAILED",
|
|
1638
|
+
authorization.value.display_text || "Payment authorization failed.",
|
|
1639
|
+
false
|
|
1640
|
+
);
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
break;
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
return this.pollUntilTerminal({
|
|
1647
|
+
orderId: checkoutResult.order_id,
|
|
1648
|
+
latestCheckoutResult,
|
|
1649
|
+
paymentReference,
|
|
1650
|
+
authorizationType: normalizeAuthorizationType(checkoutResult.authorization_type)
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1541
1653
|
async pollUntilTerminal(input) {
|
|
1542
1654
|
let consecutiveErrors = 0;
|
|
1543
1655
|
let latestCheckoutResult = input.latestCheckoutResult;
|
package/dist/react.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CimplifyClient,
|
|
1
|
+
import { C as CimplifyClient, Y as ProcessCheckoutResult, _ as CheckoutStatus, $ as CheckoutStatusContext, bq as Location, bn as Business, aS as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cK as AuthenticatedData, cG as AddressInfo, cH as PaymentMethodInfo, cM as ElementsCheckoutResult, X as ProcessCheckoutOptions } from './client-6MsOWo8f.mjs';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
3
|
import { q as Product, d as Pagination, h as CimplifyError, r as ProductWithDetails, K as Category, aw as BundleSelectionInput, a7 as ComponentSelectionInput, N as Collection, X as BundleWithDetails, a3 as CompositeWithDetails, a8 as CompositePriceResult, C as CurrencyCode } from './payment-CLIWNMaP.mjs';
|
|
4
4
|
import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-t3FBTU8p.mjs';
|
|
@@ -77,6 +77,22 @@ interface CimplifyCheckoutProps {
|
|
|
77
77
|
}
|
|
78
78
|
declare function CimplifyCheckout({ client, businessId, cartId, locationId, linkUrl, orderTypes, enrollInLink, onComplete, onError, onStatusChange, appearance, demoMode, className, }: CimplifyCheckoutProps): React.ReactElement;
|
|
79
79
|
|
|
80
|
+
interface PriceProps {
|
|
81
|
+
/** The amount in base (business) currency. */
|
|
82
|
+
amount: number | string;
|
|
83
|
+
/** Optional CSS class name for the wrapping span. */
|
|
84
|
+
className?: string;
|
|
85
|
+
/** Optional prefix rendered before the formatted price (e.g. "+"). */
|
|
86
|
+
prefix?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Price — renders a single price value in the user's chosen display currency.
|
|
90
|
+
*
|
|
91
|
+
* Reads `displayCurrency` and `convertPrice` from CimplifyProvider context
|
|
92
|
+
* so every price on the page stays consistent with the selected currency.
|
|
93
|
+
*/
|
|
94
|
+
declare function Price({ amount, className, prefix }: PriceProps): React.ReactElement;
|
|
95
|
+
|
|
80
96
|
interface CimplifyContextValue {
|
|
81
97
|
client: CimplifyClient;
|
|
82
98
|
business: Business | null;
|
|
@@ -87,6 +103,16 @@ interface CimplifyContextValue {
|
|
|
87
103
|
setCurrentLocation: (location: Location) => void;
|
|
88
104
|
isReady: boolean;
|
|
89
105
|
isDemoMode: boolean;
|
|
106
|
+
/** The business's pricing currency (always the base, for API calls). */
|
|
107
|
+
baseCurrency: string;
|
|
108
|
+
/** The currency prices are displayed in. Equals baseCurrency when no FX override is set. */
|
|
109
|
+
displayCurrency: string;
|
|
110
|
+
/** Set a display currency override for FX conversion. Pass null to reset to base currency. */
|
|
111
|
+
setDisplayCurrency: (currency: string | null) => void;
|
|
112
|
+
/** Convert a base-currency amount to the display currency. No-op when currencies match. */
|
|
113
|
+
convertPrice: (amount: number | string) => number;
|
|
114
|
+
/** Current FX rate (baseCurrency → displayCurrency). Null when no conversion is active. */
|
|
115
|
+
fxRate: number | null;
|
|
90
116
|
}
|
|
91
117
|
interface CimplifyProviderProps {
|
|
92
118
|
client?: CimplifyClient;
|
|
@@ -376,4 +402,4 @@ declare function useCheckout(): {
|
|
|
376
402
|
isLoading: boolean;
|
|
377
403
|
};
|
|
378
404
|
|
|
379
|
-
export { Ad, AdPosition, type AdProps, AdProvider, AdSlot, type AddToCartOptions, AddressElement, AuthElement, CimplifyCheckout, type CimplifyCheckoutProps, type CimplifyContextValue, CimplifyProvider, type CimplifyProviderProps, ElementsProvider, PaymentElement, type UseBundleOptions, type UseBundleResult, type UseCartItem, type UseCartOptions, type UseCartResult, type UseCategoriesOptions, type UseCategoriesResult, type UseCollectionOptions, type UseCollectionResult, type UseCollectionsOptions, type UseCollectionsResult, type UseCompositeOptions, type UseCompositeResult, type UseLocationsOptions, type UseLocationsResult, type UseOrderOptions, type UseOrderResult, type UseProductOptions, type UseProductResult, type UseProductsOptions, type UseProductsResult, type UseQuoteInput, type UseQuoteOptions, type UseQuoteResult, type UseSearchOptions, type UseSearchResult, useAds, useBundle, useCart, useCategories, useCheckout, useCimplify, useCollection, useCollections, useComposite, useElements, useElementsReady, useLocations, useOptionalCimplify, useOrder, useProduct, useProducts, useQuote, useSearch };
|
|
405
|
+
export { Ad, AdPosition, type AdProps, AdProvider, AdSlot, type AddToCartOptions, AddressElement, AuthElement, CimplifyCheckout, type CimplifyCheckoutProps, type CimplifyContextValue, CimplifyProvider, type CimplifyProviderProps, ElementsProvider, PaymentElement, Price, type PriceProps, type UseBundleOptions, type UseBundleResult, type UseCartItem, type UseCartOptions, type UseCartResult, type UseCategoriesOptions, type UseCategoriesResult, type UseCollectionOptions, type UseCollectionResult, type UseCollectionsOptions, type UseCollectionsResult, type UseCompositeOptions, type UseCompositeResult, type UseLocationsOptions, type UseLocationsResult, type UseOrderOptions, type UseOrderResult, type UseProductOptions, type UseProductResult, type UseProductsOptions, type UseProductsResult, type UseQuoteInput, type UseQuoteOptions, type UseQuoteResult, type UseSearchOptions, type UseSearchResult, useAds, useBundle, useCart, useCategories, useCheckout, useCimplify, useCollection, useCollections, useComposite, useElements, useElementsReady, useLocations, useOptionalCimplify, useOrder, useProduct, useProducts, useQuote, useSearch };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CimplifyClient,
|
|
1
|
+
import { C as CimplifyClient, Y as ProcessCheckoutResult, _ as CheckoutStatus, $ as CheckoutStatusContext, bq as Location, bn as Business, aS as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cK as AuthenticatedData, cG as AddressInfo, cH as PaymentMethodInfo, cM as ElementsCheckoutResult, X as ProcessCheckoutOptions } from './client-CVJ0S99a.js';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
3
|
import { q as Product, d as Pagination, h as CimplifyError, r as ProductWithDetails, K as Category, aw as BundleSelectionInput, a7 as ComponentSelectionInput, N as Collection, X as BundleWithDetails, a3 as CompositeWithDetails, a8 as CompositePriceResult, C as CurrencyCode } from './payment-CLIWNMaP.js';
|
|
4
4
|
import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-t3FBTU8p.js';
|
|
@@ -77,6 +77,22 @@ interface CimplifyCheckoutProps {
|
|
|
77
77
|
}
|
|
78
78
|
declare function CimplifyCheckout({ client, businessId, cartId, locationId, linkUrl, orderTypes, enrollInLink, onComplete, onError, onStatusChange, appearance, demoMode, className, }: CimplifyCheckoutProps): React.ReactElement;
|
|
79
79
|
|
|
80
|
+
interface PriceProps {
|
|
81
|
+
/** The amount in base (business) currency. */
|
|
82
|
+
amount: number | string;
|
|
83
|
+
/** Optional CSS class name for the wrapping span. */
|
|
84
|
+
className?: string;
|
|
85
|
+
/** Optional prefix rendered before the formatted price (e.g. "+"). */
|
|
86
|
+
prefix?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Price — renders a single price value in the user's chosen display currency.
|
|
90
|
+
*
|
|
91
|
+
* Reads `displayCurrency` and `convertPrice` from CimplifyProvider context
|
|
92
|
+
* so every price on the page stays consistent with the selected currency.
|
|
93
|
+
*/
|
|
94
|
+
declare function Price({ amount, className, prefix }: PriceProps): React.ReactElement;
|
|
95
|
+
|
|
80
96
|
interface CimplifyContextValue {
|
|
81
97
|
client: CimplifyClient;
|
|
82
98
|
business: Business | null;
|
|
@@ -87,6 +103,16 @@ interface CimplifyContextValue {
|
|
|
87
103
|
setCurrentLocation: (location: Location) => void;
|
|
88
104
|
isReady: boolean;
|
|
89
105
|
isDemoMode: boolean;
|
|
106
|
+
/** The business's pricing currency (always the base, for API calls). */
|
|
107
|
+
baseCurrency: string;
|
|
108
|
+
/** The currency prices are displayed in. Equals baseCurrency when no FX override is set. */
|
|
109
|
+
displayCurrency: string;
|
|
110
|
+
/** Set a display currency override for FX conversion. Pass null to reset to base currency. */
|
|
111
|
+
setDisplayCurrency: (currency: string | null) => void;
|
|
112
|
+
/** Convert a base-currency amount to the display currency. No-op when currencies match. */
|
|
113
|
+
convertPrice: (amount: number | string) => number;
|
|
114
|
+
/** Current FX rate (baseCurrency → displayCurrency). Null when no conversion is active. */
|
|
115
|
+
fxRate: number | null;
|
|
90
116
|
}
|
|
91
117
|
interface CimplifyProviderProps {
|
|
92
118
|
client?: CimplifyClient;
|
|
@@ -376,4 +402,4 @@ declare function useCheckout(): {
|
|
|
376
402
|
isLoading: boolean;
|
|
377
403
|
};
|
|
378
404
|
|
|
379
|
-
export { Ad, AdPosition, type AdProps, AdProvider, AdSlot, type AddToCartOptions, AddressElement, AuthElement, CimplifyCheckout, type CimplifyCheckoutProps, type CimplifyContextValue, CimplifyProvider, type CimplifyProviderProps, ElementsProvider, PaymentElement, type UseBundleOptions, type UseBundleResult, type UseCartItem, type UseCartOptions, type UseCartResult, type UseCategoriesOptions, type UseCategoriesResult, type UseCollectionOptions, type UseCollectionResult, type UseCollectionsOptions, type UseCollectionsResult, type UseCompositeOptions, type UseCompositeResult, type UseLocationsOptions, type UseLocationsResult, type UseOrderOptions, type UseOrderResult, type UseProductOptions, type UseProductResult, type UseProductsOptions, type UseProductsResult, type UseQuoteInput, type UseQuoteOptions, type UseQuoteResult, type UseSearchOptions, type UseSearchResult, useAds, useBundle, useCart, useCategories, useCheckout, useCimplify, useCollection, useCollections, useComposite, useElements, useElementsReady, useLocations, useOptionalCimplify, useOrder, useProduct, useProducts, useQuote, useSearch };
|
|
405
|
+
export { Ad, AdPosition, type AdProps, AdProvider, AdSlot, type AddToCartOptions, AddressElement, AuthElement, CimplifyCheckout, type CimplifyCheckoutProps, type CimplifyContextValue, CimplifyProvider, type CimplifyProviderProps, ElementsProvider, PaymentElement, Price, type PriceProps, type UseBundleOptions, type UseBundleResult, type UseCartItem, type UseCartOptions, type UseCartResult, type UseCategoriesOptions, type UseCategoriesResult, type UseCollectionOptions, type UseCollectionResult, type UseCollectionsOptions, type UseCollectionsResult, type UseCompositeOptions, type UseCompositeResult, type UseLocationsOptions, type UseLocationsResult, type UseOrderOptions, type UseOrderResult, type UseProductOptions, type UseProductResult, type UseProductsOptions, type UseProductsResult, type UseQuoteInput, type UseQuoteOptions, type UseQuoteResult, type UseSearchOptions, type UseSearchResult, useAds, useBundle, useCart, useCategories, useCheckout, useCimplify, useCollection, useCollections, useComposite, useElements, useElementsReady, useLocations, useOptionalCimplify, useOrder, useProduct, useProducts, useQuote, useSearch };
|