@cimplify/sdk 0.7.5 → 0.7.6
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 +16 -3
- package/dist/advanced.mjs +16 -3
- package/dist/{client-DvoI0EIX.d.mts → client-DsmJAS8Q.d.mts} +1 -0
- package/dist/{client-CIvQ1ZLZ.d.ts → client-Rr78TLMS.d.ts} +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -3
- package/dist/index.mjs +16 -3
- package/dist/react.d.mts +3 -2
- package/dist/react.d.ts +3 -2
- package/dist/react.js +19 -4
- package/dist/react.mjs +19 -4
- package/package.json +1 -1
package/dist/advanced.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, t as CimplifyElement, s as CimplifyElements, v as ELEMENT_TYPES, E as EVENT_TYPES, z as ElementEventType, x as ElementOptions, y as ElementType, w as ElementsOptions, F as FetchQuoteInput, q as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, p as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, o as SchedulingService, S as SearchOptions, u as createElements, k as generateIdempotencyKey } from './client-
|
|
1
|
+
export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, t as CimplifyElement, s as CimplifyElements, v as ELEMENT_TYPES, E as EVENT_TYPES, z as ElementEventType, x as ElementOptions, y as ElementType, w as ElementsOptions, F as FetchQuoteInput, q as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, p as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, o as SchedulingService, S as SearchOptions, u as createElements, k as generateIdempotencyKey } from './client-DsmJAS8Q.mjs';
|
|
2
2
|
import './payment-CLIWNMaP.mjs';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, t as CimplifyElement, s as CimplifyElements, v as ELEMENT_TYPES, E as EVENT_TYPES, z as ElementEventType, x as ElementOptions, y as ElementType, w as ElementsOptions, F as FetchQuoteInput, q as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, p as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, o as SchedulingService, S as SearchOptions, u as createElements, k as generateIdempotencyKey } from './client-
|
|
1
|
+
export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, t as CimplifyElement, s as CimplifyElements, v as ELEMENT_TYPES, E as EVENT_TYPES, z as ElementEventType, x as ElementOptions, y as ElementType, w as ElementsOptions, F as FetchQuoteInput, q as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, p as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, o as SchedulingService, S as SearchOptions, u as createElements, k as generateIdempotencyKey } from './client-Rr78TLMS.js';
|
|
2
2
|
import './payment-CLIWNMaP.js';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
package/dist/advanced.js
CHANGED
|
@@ -2186,6 +2186,12 @@ function toCheckoutError(code, message, recoverable) {
|
|
|
2186
2186
|
};
|
|
2187
2187
|
}
|
|
2188
2188
|
var DEFAULT_LINK_URL = "https://link.cimplify.io";
|
|
2189
|
+
function generateNonce() {
|
|
2190
|
+
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
2191
|
+
return crypto.randomUUID().replace(/-/g, "").slice(0, 16);
|
|
2192
|
+
}
|
|
2193
|
+
return Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2);
|
|
2194
|
+
}
|
|
2189
2195
|
function isAllowedOrigin(origin) {
|
|
2190
2196
|
try {
|
|
2191
2197
|
const url = new URL(origin);
|
|
@@ -2560,6 +2566,7 @@ var CimplifyElement = class {
|
|
|
2560
2566
|
this.linkUrl = linkUrl;
|
|
2561
2567
|
this.options = options;
|
|
2562
2568
|
this.parent = parent;
|
|
2569
|
+
this.nonce = generateNonce();
|
|
2563
2570
|
this.boundHandleMessage = this.handleMessage.bind(this);
|
|
2564
2571
|
if (typeof window !== "undefined") {
|
|
2565
2572
|
window.addEventListener("message", this.boundHandleMessage);
|
|
@@ -2646,6 +2653,7 @@ var CimplifyElement = class {
|
|
|
2646
2653
|
const iframe = document.createElement("iframe");
|
|
2647
2654
|
const url = new URL(`${this.linkUrl}/elements/${this.type}`);
|
|
2648
2655
|
url.searchParams.set("businessId", resolvedBusinessId);
|
|
2656
|
+
url.searchParams.set("nonce", this.nonce);
|
|
2649
2657
|
if (this.options.prefillEmail) url.searchParams.set("email", this.options.prefillEmail);
|
|
2650
2658
|
if (this.options.mode) url.searchParams.set("mode", this.options.mode);
|
|
2651
2659
|
iframe.src = url.toString();
|
|
@@ -2681,9 +2689,14 @@ var CimplifyElement = class {
|
|
|
2681
2689
|
if (!isAllowedOrigin(event.origin)) {
|
|
2682
2690
|
return;
|
|
2683
2691
|
}
|
|
2684
|
-
const
|
|
2685
|
-
if (
|
|
2686
|
-
return;
|
|
2692
|
+
const data = event.data;
|
|
2693
|
+
if (data?.nonce) {
|
|
2694
|
+
if (data.nonce !== this.nonce) return;
|
|
2695
|
+
} else {
|
|
2696
|
+
const iframeWindow = this.iframe?.contentWindow;
|
|
2697
|
+
if (iframeWindow && event.source && event.source !== iframeWindow) {
|
|
2698
|
+
return;
|
|
2699
|
+
}
|
|
2687
2700
|
}
|
|
2688
2701
|
const message = parseIframeMessage(event.data);
|
|
2689
2702
|
if (!message) return;
|
package/dist/advanced.mjs
CHANGED
|
@@ -2184,6 +2184,12 @@ function toCheckoutError(code, message, recoverable) {
|
|
|
2184
2184
|
};
|
|
2185
2185
|
}
|
|
2186
2186
|
var DEFAULT_LINK_URL = "https://link.cimplify.io";
|
|
2187
|
+
function generateNonce() {
|
|
2188
|
+
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
2189
|
+
return crypto.randomUUID().replace(/-/g, "").slice(0, 16);
|
|
2190
|
+
}
|
|
2191
|
+
return Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2);
|
|
2192
|
+
}
|
|
2187
2193
|
function isAllowedOrigin(origin) {
|
|
2188
2194
|
try {
|
|
2189
2195
|
const url = new URL(origin);
|
|
@@ -2558,6 +2564,7 @@ var CimplifyElement = class {
|
|
|
2558
2564
|
this.linkUrl = linkUrl;
|
|
2559
2565
|
this.options = options;
|
|
2560
2566
|
this.parent = parent;
|
|
2567
|
+
this.nonce = generateNonce();
|
|
2561
2568
|
this.boundHandleMessage = this.handleMessage.bind(this);
|
|
2562
2569
|
if (typeof window !== "undefined") {
|
|
2563
2570
|
window.addEventListener("message", this.boundHandleMessage);
|
|
@@ -2644,6 +2651,7 @@ var CimplifyElement = class {
|
|
|
2644
2651
|
const iframe = document.createElement("iframe");
|
|
2645
2652
|
const url = new URL(`${this.linkUrl}/elements/${this.type}`);
|
|
2646
2653
|
url.searchParams.set("businessId", resolvedBusinessId);
|
|
2654
|
+
url.searchParams.set("nonce", this.nonce);
|
|
2647
2655
|
if (this.options.prefillEmail) url.searchParams.set("email", this.options.prefillEmail);
|
|
2648
2656
|
if (this.options.mode) url.searchParams.set("mode", this.options.mode);
|
|
2649
2657
|
iframe.src = url.toString();
|
|
@@ -2679,9 +2687,14 @@ var CimplifyElement = class {
|
|
|
2679
2687
|
if (!isAllowedOrigin(event.origin)) {
|
|
2680
2688
|
return;
|
|
2681
2689
|
}
|
|
2682
|
-
const
|
|
2683
|
-
if (
|
|
2684
|
-
return;
|
|
2690
|
+
const data = event.data;
|
|
2691
|
+
if (data?.nonce) {
|
|
2692
|
+
if (data.nonce !== this.nonce) return;
|
|
2693
|
+
} else {
|
|
2694
|
+
const iframeWindow = this.iframe?.contentWindow;
|
|
2695
|
+
if (iframeWindow && event.source && event.source !== iframeWindow) {
|
|
2696
|
+
return;
|
|
2697
|
+
}
|
|
2685
2698
|
}
|
|
2686
2699
|
const message = parseIframeMessage(event.data);
|
|
2687
2700
|
if (!message) return;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { aa as AUTHORIZATION_TYPE, af as AUTH_MUTATION, $ as AbortablePromise, cc as AddressData, cE as AddressInfo, aP as AmountToPay, cn as AuthResponse, A as AuthService, m as AuthStatus, cG as AuthenticatedCustomer, cI as AuthenticatedData, c0 as AvailabilityCheck, c1 as AvailabilityResult, bF as AvailableSlot, bI as Booking, bH as BookingStatus, bJ as BookingWithDetails, b7 as BufferTimes, bm as Business, bA as BusinessHours, bl as BusinessPreferences, B as BusinessService, bz as BusinessSettings, bk as BusinessType, bx as BusinessWithLocations, a3 as CHECKOUT_MODE, ag as CHECKOUT_MUTATION, a6 as CHECKOUT_STEP, ac as CONTACT_TYPE, bQ as CancelBookingInput, bR as CancelBookingResult, b1 as CancelOrderInput, b9 as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aC as CatalogueResult, aD as CatalogueSnapshot, bB as CategoryInfo, bN as CheckSlotAvailabilityInput, bO as CheckSlotAvailabilityResult, cq as CheckoutAddressInfo, cs as CheckoutCustomerInfo, N as CheckoutFormData, a$ as CheckoutInput, D as CheckoutMode, j as CheckoutOperations, H as CheckoutOrderType, J as CheckoutPaymentMethod, V as CheckoutResult, j as CheckoutService, Z as CheckoutStatus, _ as CheckoutStatusContext, K as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, t as CimplifyElement, s as CimplifyElements, a2 as ContactType, c8 as CreateAddressInput, ca as CreateMobileMoneyInput, c3 as Customer, c4 as CustomerAddress, bL as CustomerBooking, bK as CustomerBookingServiceItem, c6 as CustomerLinkPreferences, c5 as CustomerMobileMoney, b6 as CustomerServicePreferences, ak as DEFAULT_COUNTRY, aj as DEFAULT_CURRENCY, ab as DEVICE_TYPE, bG as DayAvailability, bg as DepositResult, a1 as DeviceType, v as ELEMENT_TYPES, E as EVENT_TYPES, cD as ElementAppearance, cN as ElementEventHandler, z as ElementEventType, x as ElementOptions, y as ElementType, cJ as ElementsCheckoutData, cK as ElementsCheckoutResult, cH as ElementsCustomerInfo, w as ElementsOptions, ce as EnrollAndLinkOrderInput, ch as EnrollAndLinkOrderResult, cb as EnrollmentData, an as Err, aO as FeeBearerType, F as FetchQuoteInput, aM as FulfillmentLink, aL as FulfillmentStatus, aK as FulfillmentType, cu as FxQuote, ct as FxQuoteRequest, cv as FxRateResponse, q as FxService, bM as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cM as IframeToParentMessage, I as InventoryService, c2 as InventorySummary, ae as LINK_MUTATION, ad as LINK_QUERY, aQ as LineItem, aH as LineType, c7 as LinkData, cg as LinkEnrollResult, L as LinkService, ci as LinkSession, cf as LinkStatusResult, r as LiteBootstrap, p as LiteService, bp as Location, bj as LocationAppointment, b$ as LocationStock, bn as LocationTaxBehavior, bo as LocationTaxOverrides, bs as LocationTimeProfile, by as LocationWithDetails, M as MESSAGE_TYPES, a9 as MOBILE_MONEY_PROVIDER, cd as MobileMoneyData, cr as MobileMoneyDetails, a0 as MobileMoneyProvider, ai as ORDER_MUTATION, a4 as ORDER_TYPE, cC as ObservabilityHooks, am as Ok, aR as Order, aG as OrderChannel, a_ as OrderFilter, aN as OrderFulfillmentSummary, aU as OrderGroup, aY as OrderGroupDetails, aV as OrderGroupPayment, aT as OrderGroupPaymentState, aX as OrderGroupPaymentSummary, aS as OrderHistory, aI as OrderLineState, aJ as OrderLineStatus, aZ as OrderPaymentEvent, O as OrderQueries, aW as OrderSplitDetail, aE as OrderStatus, n as OtpResult, a5 as PAYMENT_METHOD, ah as PAYMENT_MUTATION, a7 as PAYMENT_STATE, a8 as PICKUP_TIME_TYPE, cL as ParentToIframeMessage, cF as PaymentMethodInfo, aF as PaymentState, cp as PickupTime, co as PickupTimeType, P as PriceQuote, bb as PricingOverrides, Y as ProcessAndResolveOptions, W as ProcessCheckoutOptions, X as ProcessCheckoutResult, bZ as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b2 as RefundOrderInput, b5 as ReminderMethod, b8 as ReminderSettings, cw as RequestContext, cz as RequestErrorEvent, cl as RequestOtpInput, cx as RequestStartEvent, cy as RequestSuccessEvent, bP as RescheduleBookingInput, bS as RescheduleBookingResult, be as ResourceAssignment, al as Result, cA as RetryEvent, ck as RevokeAllSessionsResult, cj as RevokeSessionResult, bu as Room, bc as SchedulingMetadata, bf as SchedulingResult, o as SchedulingService, S as SearchOptions, bC as Service, bT as ServiceAvailabilityParams, bU as ServiceAvailabilityResult, bv as ServiceCharge, ba as ServiceNotes, bh as ServiceScheduleRequest, b3 as ServiceStatus, cB as SessionChangeEvent, bD as Staff, bd as StaffAssignment, b4 as StaffRole, bi as StaffScheduleItem, bX as Stock, bY as StockLevel, bV as StockOwnershipType, bW as StockStatus, bw as StorefrontBootstrap, bt as Table, T as TableInfo, bq as TimeRange, br as TimeRanges, bE as TimeSlot, c9 as UpdateAddressInput, b0 as UpdateOrderStatusInput, U as UpdateProfileInput, b_ as VariantStock, cm as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, u as createElements, ap as err, au as flatMap, ay as fromPromise, k as generateIdempotencyKey, av as getOrElse, ar as isErr, aq as isOk, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './client-
|
|
1
|
+
export { aa as AUTHORIZATION_TYPE, af as AUTH_MUTATION, $ as AbortablePromise, cc as AddressData, cE as AddressInfo, aP as AmountToPay, cn as AuthResponse, A as AuthService, m as AuthStatus, cG as AuthenticatedCustomer, cI as AuthenticatedData, c0 as AvailabilityCheck, c1 as AvailabilityResult, bF as AvailableSlot, bI as Booking, bH as BookingStatus, bJ as BookingWithDetails, b7 as BufferTimes, bm as Business, bA as BusinessHours, bl as BusinessPreferences, B as BusinessService, bz as BusinessSettings, bk as BusinessType, bx as BusinessWithLocations, a3 as CHECKOUT_MODE, ag as CHECKOUT_MUTATION, a6 as CHECKOUT_STEP, ac as CONTACT_TYPE, bQ as CancelBookingInput, bR as CancelBookingResult, b1 as CancelOrderInput, b9 as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aC as CatalogueResult, aD as CatalogueSnapshot, bB as CategoryInfo, bN as CheckSlotAvailabilityInput, bO as CheckSlotAvailabilityResult, cq as CheckoutAddressInfo, cs as CheckoutCustomerInfo, N as CheckoutFormData, a$ as CheckoutInput, D as CheckoutMode, j as CheckoutOperations, H as CheckoutOrderType, J as CheckoutPaymentMethod, V as CheckoutResult, j as CheckoutService, Z as CheckoutStatus, _ as CheckoutStatusContext, K as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, t as CimplifyElement, s as CimplifyElements, a2 as ContactType, c8 as CreateAddressInput, ca as CreateMobileMoneyInput, c3 as Customer, c4 as CustomerAddress, bL as CustomerBooking, bK as CustomerBookingServiceItem, c6 as CustomerLinkPreferences, c5 as CustomerMobileMoney, b6 as CustomerServicePreferences, ak as DEFAULT_COUNTRY, aj as DEFAULT_CURRENCY, ab as DEVICE_TYPE, bG as DayAvailability, bg as DepositResult, a1 as DeviceType, v as ELEMENT_TYPES, E as EVENT_TYPES, cD as ElementAppearance, cN as ElementEventHandler, z as ElementEventType, x as ElementOptions, y as ElementType, cJ as ElementsCheckoutData, cK as ElementsCheckoutResult, cH as ElementsCustomerInfo, w as ElementsOptions, ce as EnrollAndLinkOrderInput, ch as EnrollAndLinkOrderResult, cb as EnrollmentData, an as Err, aO as FeeBearerType, F as FetchQuoteInput, aM as FulfillmentLink, aL as FulfillmentStatus, aK as FulfillmentType, cu as FxQuote, ct as FxQuoteRequest, cv as FxRateResponse, q as FxService, bM as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cM as IframeToParentMessage, I as InventoryService, c2 as InventorySummary, ae as LINK_MUTATION, ad as LINK_QUERY, aQ as LineItem, aH as LineType, c7 as LinkData, cg as LinkEnrollResult, L as LinkService, ci as LinkSession, cf as LinkStatusResult, r as LiteBootstrap, p as LiteService, bp as Location, bj as LocationAppointment, b$ as LocationStock, bn as LocationTaxBehavior, bo as LocationTaxOverrides, bs as LocationTimeProfile, by as LocationWithDetails, M as MESSAGE_TYPES, a9 as MOBILE_MONEY_PROVIDER, cd as MobileMoneyData, cr as MobileMoneyDetails, a0 as MobileMoneyProvider, ai as ORDER_MUTATION, a4 as ORDER_TYPE, cC as ObservabilityHooks, am as Ok, aR as Order, aG as OrderChannel, a_ as OrderFilter, aN as OrderFulfillmentSummary, aU as OrderGroup, aY as OrderGroupDetails, aV as OrderGroupPayment, aT as OrderGroupPaymentState, aX as OrderGroupPaymentSummary, aS as OrderHistory, aI as OrderLineState, aJ as OrderLineStatus, aZ as OrderPaymentEvent, O as OrderQueries, aW as OrderSplitDetail, aE as OrderStatus, n as OtpResult, a5 as PAYMENT_METHOD, ah as PAYMENT_MUTATION, a7 as PAYMENT_STATE, a8 as PICKUP_TIME_TYPE, cL as ParentToIframeMessage, cF as PaymentMethodInfo, aF as PaymentState, cp as PickupTime, co as PickupTimeType, P as PriceQuote, bb as PricingOverrides, Y as ProcessAndResolveOptions, W as ProcessCheckoutOptions, X as ProcessCheckoutResult, bZ as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b2 as RefundOrderInput, b5 as ReminderMethod, b8 as ReminderSettings, cw as RequestContext, cz as RequestErrorEvent, cl as RequestOtpInput, cx as RequestStartEvent, cy as RequestSuccessEvent, bP as RescheduleBookingInput, bS as RescheduleBookingResult, be as ResourceAssignment, al as Result, cA as RetryEvent, ck as RevokeAllSessionsResult, cj as RevokeSessionResult, bu as Room, bc as SchedulingMetadata, bf as SchedulingResult, o as SchedulingService, S as SearchOptions, bC as Service, bT as ServiceAvailabilityParams, bU as ServiceAvailabilityResult, bv as ServiceCharge, ba as ServiceNotes, bh as ServiceScheduleRequest, b3 as ServiceStatus, cB as SessionChangeEvent, bD as Staff, bd as StaffAssignment, b4 as StaffRole, bi as StaffScheduleItem, bX as Stock, bY as StockLevel, bV as StockOwnershipType, bW as StockStatus, bw as StorefrontBootstrap, bt as Table, T as TableInfo, bq as TimeRange, br as TimeRanges, bE as TimeSlot, c9 as UpdateAddressInput, b0 as UpdateOrderStatusInput, U as UpdateProfileInput, b_ as VariantStock, cm as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, u as createElements, ap as err, au as flatMap, ay as fromPromise, k as generateIdempotencyKey, av as getOrElse, ar as isErr, aq as isOk, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './client-DsmJAS8Q.mjs';
|
|
2
2
|
export { QueryBuilder, query } from './advanced.mjs';
|
|
3
3
|
import { A as ApiError } from './payment-CLIWNMaP.mjs';
|
|
4
4
|
export { B as AddOn, at as AddOnDetails, aP as AddOnGroupDetails, G as AddOnOption, aO as AddOnOptionDetails, H as AddOnOptionPrice, F as AddOnWithOptions, aU as AddToCartInput, ai as AdjustmentType, ap as AppliedDiscount, a_ as AuthorizationType, ao as BenefitType, T as Bundle, Y as BundleComponentData, _ as BundleComponentInfo, R as BundlePriceType, W as BundleProduct, ay as BundleSelectionData, aw as BundleSelectionInput, ax as BundleStoredSelection, U as BundleSummary, X as BundleWithDetails, aD as Cart, au as CartAddOn, ag as CartChannel, aE as CartItem, aR as CartItemDetails, af as CartStatus, aW as CartSummary, aF as CartTotals, K as Category, L as CategorySummary, an as ChosenPrice, h as CimplifyError, N as Collection, Q as CollectionProduct, O as CollectionSummary, a4 as ComponentGroup, a5 as ComponentGroupWithComponents, a9 as ComponentPriceBreakdown, a7 as ComponentSelectionInput, a1 as ComponentSourceType, a2 as Composite, a6 as CompositeComponent, aA as CompositePriceBreakdown, a8 as CompositePriceResult, $ as CompositePricingMode, aB as CompositeSelectionData, a7 as CompositeSelectionInput, az as CompositeStoredSelection, a3 as CompositeWithDetails, b as Currency, C as CurrencyCode, p as DepositType, D as DigitalProductType, aq as DiscountBreakdown, ar as DiscountDetails, aI as DisplayAddOn, aJ as DisplayAddOnOption, aG as DisplayCart, aH as DisplayCartItem, g as ERROR_HINTS, E as ErrorCode, e as ErrorCodeType, f as ErrorHint, a0 as GroupPricingBehavior, b2 as InitializePaymentResult, I as InventoryType, aC as LineConfiguration, ac as LocationProductPrice, M as Money, d as Pagination, P as PaginationParams, b1 as Payment, b5 as PaymentErrorDetails, b0 as PaymentMethod, aZ as PaymentMethodType, a$ as PaymentProcessingState, aY as PaymentProvider, b3 as PaymentResponse, aX as PaymentStatus, b4 as PaymentStatusResponse, ab as Price, aj as PriceAdjustment, am as PriceDecisionPath, aa as PriceEntryType, al as PricePathTaxInfo, ah as PriceSource, q as Product, J as ProductAddOn, ad as ProductAvailability, o as ProductRenderHint, ae as ProductTimeProfile, n as ProductType, s as ProductVariant, x as ProductVariantValue, r as ProductWithDetails, S as SalesChannel, as as SelectedAddOnOption, b6 as SubmitAuthorizationInput, ak as TaxPathComponent, aS as UICart, aK as UICartBusiness, aM as UICartCustomer, aL as UICartLocation, aN as UICartPricing, aT as UICartResponse, aV as UpdateCartItemInput, u as VariantAxis, z as VariantAxisSelection, w as VariantAxisValue, v as VariantAxisWithValues, av as VariantDetails, aQ as VariantDetailsDTO, t as VariantDisplayAttribute, y as VariantLocationAvailability, V as VariantStrategy, Z as ZERO, c as currencyCode, k as enrichError, j as getErrorHint, i as isCimplifyError, l as isRetryableError, m as money, a as moneyFromNumber } from './payment-CLIWNMaP.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { aa as AUTHORIZATION_TYPE, af as AUTH_MUTATION, $ as AbortablePromise, cc as AddressData, cE as AddressInfo, aP as AmountToPay, cn as AuthResponse, A as AuthService, m as AuthStatus, cG as AuthenticatedCustomer, cI as AuthenticatedData, c0 as AvailabilityCheck, c1 as AvailabilityResult, bF as AvailableSlot, bI as Booking, bH as BookingStatus, bJ as BookingWithDetails, b7 as BufferTimes, bm as Business, bA as BusinessHours, bl as BusinessPreferences, B as BusinessService, bz as BusinessSettings, bk as BusinessType, bx as BusinessWithLocations, a3 as CHECKOUT_MODE, ag as CHECKOUT_MUTATION, a6 as CHECKOUT_STEP, ac as CONTACT_TYPE, bQ as CancelBookingInput, bR as CancelBookingResult, b1 as CancelOrderInput, b9 as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aC as CatalogueResult, aD as CatalogueSnapshot, bB as CategoryInfo, bN as CheckSlotAvailabilityInput, bO as CheckSlotAvailabilityResult, cq as CheckoutAddressInfo, cs as CheckoutCustomerInfo, N as CheckoutFormData, a$ as CheckoutInput, D as CheckoutMode, j as CheckoutOperations, H as CheckoutOrderType, J as CheckoutPaymentMethod, V as CheckoutResult, j as CheckoutService, Z as CheckoutStatus, _ as CheckoutStatusContext, K as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, t as CimplifyElement, s as CimplifyElements, a2 as ContactType, c8 as CreateAddressInput, ca as CreateMobileMoneyInput, c3 as Customer, c4 as CustomerAddress, bL as CustomerBooking, bK as CustomerBookingServiceItem, c6 as CustomerLinkPreferences, c5 as CustomerMobileMoney, b6 as CustomerServicePreferences, ak as DEFAULT_COUNTRY, aj as DEFAULT_CURRENCY, ab as DEVICE_TYPE, bG as DayAvailability, bg as DepositResult, a1 as DeviceType, v as ELEMENT_TYPES, E as EVENT_TYPES, cD as ElementAppearance, cN as ElementEventHandler, z as ElementEventType, x as ElementOptions, y as ElementType, cJ as ElementsCheckoutData, cK as ElementsCheckoutResult, cH as ElementsCustomerInfo, w as ElementsOptions, ce as EnrollAndLinkOrderInput, ch as EnrollAndLinkOrderResult, cb as EnrollmentData, an as Err, aO as FeeBearerType, F as FetchQuoteInput, aM as FulfillmentLink, aL as FulfillmentStatus, aK as FulfillmentType, cu as FxQuote, ct as FxQuoteRequest, cv as FxRateResponse, q as FxService, bM as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cM as IframeToParentMessage, I as InventoryService, c2 as InventorySummary, ae as LINK_MUTATION, ad as LINK_QUERY, aQ as LineItem, aH as LineType, c7 as LinkData, cg as LinkEnrollResult, L as LinkService, ci as LinkSession, cf as LinkStatusResult, r as LiteBootstrap, p as LiteService, bp as Location, bj as LocationAppointment, b$ as LocationStock, bn as LocationTaxBehavior, bo as LocationTaxOverrides, bs as LocationTimeProfile, by as LocationWithDetails, M as MESSAGE_TYPES, a9 as MOBILE_MONEY_PROVIDER, cd as MobileMoneyData, cr as MobileMoneyDetails, a0 as MobileMoneyProvider, ai as ORDER_MUTATION, a4 as ORDER_TYPE, cC as ObservabilityHooks, am as Ok, aR as Order, aG as OrderChannel, a_ as OrderFilter, aN as OrderFulfillmentSummary, aU as OrderGroup, aY as OrderGroupDetails, aV as OrderGroupPayment, aT as OrderGroupPaymentState, aX as OrderGroupPaymentSummary, aS as OrderHistory, aI as OrderLineState, aJ as OrderLineStatus, aZ as OrderPaymentEvent, O as OrderQueries, aW as OrderSplitDetail, aE as OrderStatus, n as OtpResult, a5 as PAYMENT_METHOD, ah as PAYMENT_MUTATION, a7 as PAYMENT_STATE, a8 as PICKUP_TIME_TYPE, cL as ParentToIframeMessage, cF as PaymentMethodInfo, aF as PaymentState, cp as PickupTime, co as PickupTimeType, P as PriceQuote, bb as PricingOverrides, Y as ProcessAndResolveOptions, W as ProcessCheckoutOptions, X as ProcessCheckoutResult, bZ as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b2 as RefundOrderInput, b5 as ReminderMethod, b8 as ReminderSettings, cw as RequestContext, cz as RequestErrorEvent, cl as RequestOtpInput, cx as RequestStartEvent, cy as RequestSuccessEvent, bP as RescheduleBookingInput, bS as RescheduleBookingResult, be as ResourceAssignment, al as Result, cA as RetryEvent, ck as RevokeAllSessionsResult, cj as RevokeSessionResult, bu as Room, bc as SchedulingMetadata, bf as SchedulingResult, o as SchedulingService, S as SearchOptions, bC as Service, bT as ServiceAvailabilityParams, bU as ServiceAvailabilityResult, bv as ServiceCharge, ba as ServiceNotes, bh as ServiceScheduleRequest, b3 as ServiceStatus, cB as SessionChangeEvent, bD as Staff, bd as StaffAssignment, b4 as StaffRole, bi as StaffScheduleItem, bX as Stock, bY as StockLevel, bV as StockOwnershipType, bW as StockStatus, bw as StorefrontBootstrap, bt as Table, T as TableInfo, bq as TimeRange, br as TimeRanges, bE as TimeSlot, c9 as UpdateAddressInput, b0 as UpdateOrderStatusInput, U as UpdateProfileInput, b_ as VariantStock, cm as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, u as createElements, ap as err, au as flatMap, ay as fromPromise, k as generateIdempotencyKey, av as getOrElse, ar as isErr, aq as isOk, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './client-
|
|
1
|
+
export { aa as AUTHORIZATION_TYPE, af as AUTH_MUTATION, $ as AbortablePromise, cc as AddressData, cE as AddressInfo, aP as AmountToPay, cn as AuthResponse, A as AuthService, m as AuthStatus, cG as AuthenticatedCustomer, cI as AuthenticatedData, c0 as AvailabilityCheck, c1 as AvailabilityResult, bF as AvailableSlot, bI as Booking, bH as BookingStatus, bJ as BookingWithDetails, b7 as BufferTimes, bm as Business, bA as BusinessHours, bl as BusinessPreferences, B as BusinessService, bz as BusinessSettings, bk as BusinessType, bx as BusinessWithLocations, a3 as CHECKOUT_MODE, ag as CHECKOUT_MUTATION, a6 as CHECKOUT_STEP, ac as CONTACT_TYPE, bQ as CancelBookingInput, bR as CancelBookingResult, b1 as CancelOrderInput, b9 as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aC as CatalogueResult, aD as CatalogueSnapshot, bB as CategoryInfo, bN as CheckSlotAvailabilityInput, bO as CheckSlotAvailabilityResult, cq as CheckoutAddressInfo, cs as CheckoutCustomerInfo, N as CheckoutFormData, a$ as CheckoutInput, D as CheckoutMode, j as CheckoutOperations, H as CheckoutOrderType, J as CheckoutPaymentMethod, V as CheckoutResult, j as CheckoutService, Z as CheckoutStatus, _ as CheckoutStatusContext, K as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, t as CimplifyElement, s as CimplifyElements, a2 as ContactType, c8 as CreateAddressInput, ca as CreateMobileMoneyInput, c3 as Customer, c4 as CustomerAddress, bL as CustomerBooking, bK as CustomerBookingServiceItem, c6 as CustomerLinkPreferences, c5 as CustomerMobileMoney, b6 as CustomerServicePreferences, ak as DEFAULT_COUNTRY, aj as DEFAULT_CURRENCY, ab as DEVICE_TYPE, bG as DayAvailability, bg as DepositResult, a1 as DeviceType, v as ELEMENT_TYPES, E as EVENT_TYPES, cD as ElementAppearance, cN as ElementEventHandler, z as ElementEventType, x as ElementOptions, y as ElementType, cJ as ElementsCheckoutData, cK as ElementsCheckoutResult, cH as ElementsCustomerInfo, w as ElementsOptions, ce as EnrollAndLinkOrderInput, ch as EnrollAndLinkOrderResult, cb as EnrollmentData, an as Err, aO as FeeBearerType, F as FetchQuoteInput, aM as FulfillmentLink, aL as FulfillmentStatus, aK as FulfillmentType, cu as FxQuote, ct as FxQuoteRequest, cv as FxRateResponse, q as FxService, bM as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cM as IframeToParentMessage, I as InventoryService, c2 as InventorySummary, ae as LINK_MUTATION, ad as LINK_QUERY, aQ as LineItem, aH as LineType, c7 as LinkData, cg as LinkEnrollResult, L as LinkService, ci as LinkSession, cf as LinkStatusResult, r as LiteBootstrap, p as LiteService, bp as Location, bj as LocationAppointment, b$ as LocationStock, bn as LocationTaxBehavior, bo as LocationTaxOverrides, bs as LocationTimeProfile, by as LocationWithDetails, M as MESSAGE_TYPES, a9 as MOBILE_MONEY_PROVIDER, cd as MobileMoneyData, cr as MobileMoneyDetails, a0 as MobileMoneyProvider, ai as ORDER_MUTATION, a4 as ORDER_TYPE, cC as ObservabilityHooks, am as Ok, aR as Order, aG as OrderChannel, a_ as OrderFilter, aN as OrderFulfillmentSummary, aU as OrderGroup, aY as OrderGroupDetails, aV as OrderGroupPayment, aT as OrderGroupPaymentState, aX as OrderGroupPaymentSummary, aS as OrderHistory, aI as OrderLineState, aJ as OrderLineStatus, aZ as OrderPaymentEvent, O as OrderQueries, aW as OrderSplitDetail, aE as OrderStatus, n as OtpResult, a5 as PAYMENT_METHOD, ah as PAYMENT_MUTATION, a7 as PAYMENT_STATE, a8 as PICKUP_TIME_TYPE, cL as ParentToIframeMessage, cF as PaymentMethodInfo, aF as PaymentState, cp as PickupTime, co as PickupTimeType, P as PriceQuote, bb as PricingOverrides, Y as ProcessAndResolveOptions, W as ProcessCheckoutOptions, X as ProcessCheckoutResult, bZ as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b2 as RefundOrderInput, b5 as ReminderMethod, b8 as ReminderSettings, cw as RequestContext, cz as RequestErrorEvent, cl as RequestOtpInput, cx as RequestStartEvent, cy as RequestSuccessEvent, bP as RescheduleBookingInput, bS as RescheduleBookingResult, be as ResourceAssignment, al as Result, cA as RetryEvent, ck as RevokeAllSessionsResult, cj as RevokeSessionResult, bu as Room, bc as SchedulingMetadata, bf as SchedulingResult, o as SchedulingService, S as SearchOptions, bC as Service, bT as ServiceAvailabilityParams, bU as ServiceAvailabilityResult, bv as ServiceCharge, ba as ServiceNotes, bh as ServiceScheduleRequest, b3 as ServiceStatus, cB as SessionChangeEvent, bD as Staff, bd as StaffAssignment, b4 as StaffRole, bi as StaffScheduleItem, bX as Stock, bY as StockLevel, bV as StockOwnershipType, bW as StockStatus, bw as StorefrontBootstrap, bt as Table, T as TableInfo, bq as TimeRange, br as TimeRanges, bE as TimeSlot, c9 as UpdateAddressInput, b0 as UpdateOrderStatusInput, U as UpdateProfileInput, b_ as VariantStock, cm as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, u as createElements, ap as err, au as flatMap, ay as fromPromise, k as generateIdempotencyKey, av as getOrElse, ar as isErr, aq as isOk, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './client-Rr78TLMS.js';
|
|
2
2
|
export { QueryBuilder, query } from './advanced.js';
|
|
3
3
|
import { A as ApiError } from './payment-CLIWNMaP.js';
|
|
4
4
|
export { B as AddOn, at as AddOnDetails, aP as AddOnGroupDetails, G as AddOnOption, aO as AddOnOptionDetails, H as AddOnOptionPrice, F as AddOnWithOptions, aU as AddToCartInput, ai as AdjustmentType, ap as AppliedDiscount, a_ as AuthorizationType, ao as BenefitType, T as Bundle, Y as BundleComponentData, _ as BundleComponentInfo, R as BundlePriceType, W as BundleProduct, ay as BundleSelectionData, aw as BundleSelectionInput, ax as BundleStoredSelection, U as BundleSummary, X as BundleWithDetails, aD as Cart, au as CartAddOn, ag as CartChannel, aE as CartItem, aR as CartItemDetails, af as CartStatus, aW as CartSummary, aF as CartTotals, K as Category, L as CategorySummary, an as ChosenPrice, h as CimplifyError, N as Collection, Q as CollectionProduct, O as CollectionSummary, a4 as ComponentGroup, a5 as ComponentGroupWithComponents, a9 as ComponentPriceBreakdown, a7 as ComponentSelectionInput, a1 as ComponentSourceType, a2 as Composite, a6 as CompositeComponent, aA as CompositePriceBreakdown, a8 as CompositePriceResult, $ as CompositePricingMode, aB as CompositeSelectionData, a7 as CompositeSelectionInput, az as CompositeStoredSelection, a3 as CompositeWithDetails, b as Currency, C as CurrencyCode, p as DepositType, D as DigitalProductType, aq as DiscountBreakdown, ar as DiscountDetails, aI as DisplayAddOn, aJ as DisplayAddOnOption, aG as DisplayCart, aH as DisplayCartItem, g as ERROR_HINTS, E as ErrorCode, e as ErrorCodeType, f as ErrorHint, a0 as GroupPricingBehavior, b2 as InitializePaymentResult, I as InventoryType, aC as LineConfiguration, ac as LocationProductPrice, M as Money, d as Pagination, P as PaginationParams, b1 as Payment, b5 as PaymentErrorDetails, b0 as PaymentMethod, aZ as PaymentMethodType, a$ as PaymentProcessingState, aY as PaymentProvider, b3 as PaymentResponse, aX as PaymentStatus, b4 as PaymentStatusResponse, ab as Price, aj as PriceAdjustment, am as PriceDecisionPath, aa as PriceEntryType, al as PricePathTaxInfo, ah as PriceSource, q as Product, J as ProductAddOn, ad as ProductAvailability, o as ProductRenderHint, ae as ProductTimeProfile, n as ProductType, s as ProductVariant, x as ProductVariantValue, r as ProductWithDetails, S as SalesChannel, as as SelectedAddOnOption, b6 as SubmitAuthorizationInput, ak as TaxPathComponent, aS as UICart, aK as UICartBusiness, aM as UICartCustomer, aL as UICartLocation, aN as UICartPricing, aT as UICartResponse, aV as UpdateCartItemInput, u as VariantAxis, z as VariantAxisSelection, w as VariantAxisValue, v as VariantAxisWithValues, av as VariantDetails, aQ as VariantDetailsDTO, t as VariantDisplayAttribute, y as VariantLocationAvailability, V as VariantStrategy, Z as ZERO, c as currencyCode, k as enrichError, j as getErrorHint, i as isCimplifyError, l as isRetryableError, m as money, a as moneyFromNumber } from './payment-CLIWNMaP.js';
|
package/dist/index.js
CHANGED
|
@@ -2634,6 +2634,12 @@ function toCheckoutError(code, message, recoverable) {
|
|
|
2634
2634
|
};
|
|
2635
2635
|
}
|
|
2636
2636
|
var DEFAULT_LINK_URL = "https://link.cimplify.io";
|
|
2637
|
+
function generateNonce() {
|
|
2638
|
+
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
2639
|
+
return crypto.randomUUID().replace(/-/g, "").slice(0, 16);
|
|
2640
|
+
}
|
|
2641
|
+
return Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2);
|
|
2642
|
+
}
|
|
2637
2643
|
function isAllowedOrigin(origin) {
|
|
2638
2644
|
try {
|
|
2639
2645
|
const url = new URL(origin);
|
|
@@ -3008,6 +3014,7 @@ var CimplifyElement = class {
|
|
|
3008
3014
|
this.linkUrl = linkUrl;
|
|
3009
3015
|
this.options = options;
|
|
3010
3016
|
this.parent = parent;
|
|
3017
|
+
this.nonce = generateNonce();
|
|
3011
3018
|
this.boundHandleMessage = this.handleMessage.bind(this);
|
|
3012
3019
|
if (typeof window !== "undefined") {
|
|
3013
3020
|
window.addEventListener("message", this.boundHandleMessage);
|
|
@@ -3094,6 +3101,7 @@ var CimplifyElement = class {
|
|
|
3094
3101
|
const iframe = document.createElement("iframe");
|
|
3095
3102
|
const url = new URL(`${this.linkUrl}/elements/${this.type}`);
|
|
3096
3103
|
url.searchParams.set("businessId", resolvedBusinessId);
|
|
3104
|
+
url.searchParams.set("nonce", this.nonce);
|
|
3097
3105
|
if (this.options.prefillEmail) url.searchParams.set("email", this.options.prefillEmail);
|
|
3098
3106
|
if (this.options.mode) url.searchParams.set("mode", this.options.mode);
|
|
3099
3107
|
iframe.src = url.toString();
|
|
@@ -3129,9 +3137,14 @@ var CimplifyElement = class {
|
|
|
3129
3137
|
if (!isAllowedOrigin(event.origin)) {
|
|
3130
3138
|
return;
|
|
3131
3139
|
}
|
|
3132
|
-
const
|
|
3133
|
-
if (
|
|
3134
|
-
return;
|
|
3140
|
+
const data = event.data;
|
|
3141
|
+
if (data?.nonce) {
|
|
3142
|
+
if (data.nonce !== this.nonce) return;
|
|
3143
|
+
} else {
|
|
3144
|
+
const iframeWindow = this.iframe?.contentWindow;
|
|
3145
|
+
if (iframeWindow && event.source && event.source !== iframeWindow) {
|
|
3146
|
+
return;
|
|
3147
|
+
}
|
|
3135
3148
|
}
|
|
3136
3149
|
const message = parseIframeMessage(event.data);
|
|
3137
3150
|
if (!message) return;
|
package/dist/index.mjs
CHANGED
|
@@ -2632,6 +2632,12 @@ function toCheckoutError(code, message, recoverable) {
|
|
|
2632
2632
|
};
|
|
2633
2633
|
}
|
|
2634
2634
|
var DEFAULT_LINK_URL = "https://link.cimplify.io";
|
|
2635
|
+
function generateNonce() {
|
|
2636
|
+
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
2637
|
+
return crypto.randomUUID().replace(/-/g, "").slice(0, 16);
|
|
2638
|
+
}
|
|
2639
|
+
return Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2);
|
|
2640
|
+
}
|
|
2635
2641
|
function isAllowedOrigin(origin) {
|
|
2636
2642
|
try {
|
|
2637
2643
|
const url = new URL(origin);
|
|
@@ -3006,6 +3012,7 @@ var CimplifyElement = class {
|
|
|
3006
3012
|
this.linkUrl = linkUrl;
|
|
3007
3013
|
this.options = options;
|
|
3008
3014
|
this.parent = parent;
|
|
3015
|
+
this.nonce = generateNonce();
|
|
3009
3016
|
this.boundHandleMessage = this.handleMessage.bind(this);
|
|
3010
3017
|
if (typeof window !== "undefined") {
|
|
3011
3018
|
window.addEventListener("message", this.boundHandleMessage);
|
|
@@ -3092,6 +3099,7 @@ var CimplifyElement = class {
|
|
|
3092
3099
|
const iframe = document.createElement("iframe");
|
|
3093
3100
|
const url = new URL(`${this.linkUrl}/elements/${this.type}`);
|
|
3094
3101
|
url.searchParams.set("businessId", resolvedBusinessId);
|
|
3102
|
+
url.searchParams.set("nonce", this.nonce);
|
|
3095
3103
|
if (this.options.prefillEmail) url.searchParams.set("email", this.options.prefillEmail);
|
|
3096
3104
|
if (this.options.mode) url.searchParams.set("mode", this.options.mode);
|
|
3097
3105
|
iframe.src = url.toString();
|
|
@@ -3127,9 +3135,14 @@ var CimplifyElement = class {
|
|
|
3127
3135
|
if (!isAllowedOrigin(event.origin)) {
|
|
3128
3136
|
return;
|
|
3129
3137
|
}
|
|
3130
|
-
const
|
|
3131
|
-
if (
|
|
3132
|
-
return;
|
|
3138
|
+
const data = event.data;
|
|
3139
|
+
if (data?.nonce) {
|
|
3140
|
+
if (data.nonce !== this.nonce) return;
|
|
3141
|
+
} else {
|
|
3142
|
+
const iframeWindow = this.iframe?.contentWindow;
|
|
3143
|
+
if (iframeWindow && event.source && event.source !== iframeWindow) {
|
|
3144
|
+
return;
|
|
3145
|
+
}
|
|
3133
3146
|
}
|
|
3134
3147
|
const message = parseIframeMessage(event.data);
|
|
3135
3148
|
if (!message) return;
|
package/dist/react.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CimplifyClient, X as ProcessCheckoutResult, Z as CheckoutStatus, _ as CheckoutStatusContext, bp as Location, bm as Business, aR as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cI as AuthenticatedData, cE as AddressInfo, cF as PaymentMethodInfo, cK as ElementsCheckoutResult, W as ProcessCheckoutOptions } from './client-
|
|
1
|
+
import { C as CimplifyClient, X as ProcessCheckoutResult, Z as CheckoutStatus, _ as CheckoutStatusContext, bp as Location, bm as Business, aR as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cI as AuthenticatedData, cE as AddressInfo, cF as PaymentMethodInfo, cK as ElementsCheckoutResult, W as ProcessCheckoutOptions } from './client-DsmJAS8Q.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';
|
|
@@ -55,6 +55,7 @@ interface CimplifyCheckoutProps {
|
|
|
55
55
|
businessId?: string;
|
|
56
56
|
cartId?: string;
|
|
57
57
|
locationId?: string;
|
|
58
|
+
linkUrl?: string;
|
|
58
59
|
orderTypes?: CheckoutOrderType[];
|
|
59
60
|
enrollInLink?: boolean;
|
|
60
61
|
onComplete: (result: ProcessCheckoutResult) => void;
|
|
@@ -74,7 +75,7 @@ interface CimplifyCheckoutProps {
|
|
|
74
75
|
demoMode?: boolean;
|
|
75
76
|
className?: string;
|
|
76
77
|
}
|
|
77
|
-
declare function CimplifyCheckout({ client, businessId, cartId, locationId, orderTypes, enrollInLink, onComplete, onError, onStatusChange, appearance, demoMode, className, }: CimplifyCheckoutProps): React.ReactElement;
|
|
78
|
+
declare function CimplifyCheckout({ client, businessId, cartId, locationId, linkUrl, orderTypes, enrollInLink, onComplete, onError, onStatusChange, appearance, demoMode, className, }: CimplifyCheckoutProps): React.ReactElement;
|
|
78
79
|
|
|
79
80
|
interface CimplifyContextValue {
|
|
80
81
|
client: CimplifyClient;
|
package/dist/react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CimplifyClient, X as ProcessCheckoutResult, Z as CheckoutStatus, _ as CheckoutStatusContext, bp as Location, bm as Business, aR as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cI as AuthenticatedData, cE as AddressInfo, cF as PaymentMethodInfo, cK as ElementsCheckoutResult, W as ProcessCheckoutOptions } from './client-
|
|
1
|
+
import { C as CimplifyClient, X as ProcessCheckoutResult, Z as CheckoutStatus, _ as CheckoutStatusContext, bp as Location, bm as Business, aR as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cI as AuthenticatedData, cE as AddressInfo, cF as PaymentMethodInfo, cK as ElementsCheckoutResult, W as ProcessCheckoutOptions } from './client-Rr78TLMS.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';
|
|
@@ -55,6 +55,7 @@ interface CimplifyCheckoutProps {
|
|
|
55
55
|
businessId?: string;
|
|
56
56
|
cartId?: string;
|
|
57
57
|
locationId?: string;
|
|
58
|
+
linkUrl?: string;
|
|
58
59
|
orderTypes?: CheckoutOrderType[];
|
|
59
60
|
enrollInLink?: boolean;
|
|
60
61
|
onComplete: (result: ProcessCheckoutResult) => void;
|
|
@@ -74,7 +75,7 @@ interface CimplifyCheckoutProps {
|
|
|
74
75
|
demoMode?: boolean;
|
|
75
76
|
className?: string;
|
|
76
77
|
}
|
|
77
|
-
declare function CimplifyCheckout({ client, businessId, cartId, locationId, orderTypes, enrollInLink, onComplete, onError, onStatusChange, appearance, demoMode, className, }: CimplifyCheckoutProps): React.ReactElement;
|
|
78
|
+
declare function CimplifyCheckout({ client, businessId, cartId, locationId, linkUrl, orderTypes, enrollInLink, onComplete, onError, onStatusChange, appearance, demoMode, className, }: CimplifyCheckoutProps): React.ReactElement;
|
|
78
79
|
|
|
79
80
|
interface CimplifyContextValue {
|
|
80
81
|
client: CimplifyClient;
|
package/dist/react.js
CHANGED
|
@@ -379,6 +379,7 @@ function CimplifyCheckout({
|
|
|
379
379
|
businessId,
|
|
380
380
|
cartId,
|
|
381
381
|
locationId,
|
|
382
|
+
linkUrl,
|
|
382
383
|
orderTypes,
|
|
383
384
|
enrollInLink = true,
|
|
384
385
|
onComplete,
|
|
@@ -517,7 +518,8 @@ function CimplifyCheckout({
|
|
|
517
518
|
return;
|
|
518
519
|
}
|
|
519
520
|
const elements = client.elements(resolvedBusinessId, {
|
|
520
|
-
appearance: initialAppearanceRef.current
|
|
521
|
+
appearance: initialAppearanceRef.current,
|
|
522
|
+
linkUrl
|
|
521
523
|
});
|
|
522
524
|
elementsRef.current = elements;
|
|
523
525
|
const auth = elements.create("auth");
|
|
@@ -2875,6 +2877,12 @@ function toCheckoutError(code, message, recoverable) {
|
|
|
2875
2877
|
};
|
|
2876
2878
|
}
|
|
2877
2879
|
var DEFAULT_LINK_URL = "https://link.cimplify.io";
|
|
2880
|
+
function generateNonce() {
|
|
2881
|
+
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
2882
|
+
return crypto.randomUUID().replace(/-/g, "").slice(0, 16);
|
|
2883
|
+
}
|
|
2884
|
+
return Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2);
|
|
2885
|
+
}
|
|
2878
2886
|
function isAllowedOrigin(origin) {
|
|
2879
2887
|
try {
|
|
2880
2888
|
const url = new URL(origin);
|
|
@@ -3249,6 +3257,7 @@ var CimplifyElement = class {
|
|
|
3249
3257
|
this.linkUrl = linkUrl;
|
|
3250
3258
|
this.options = options;
|
|
3251
3259
|
this.parent = parent;
|
|
3260
|
+
this.nonce = generateNonce();
|
|
3252
3261
|
this.boundHandleMessage = this.handleMessage.bind(this);
|
|
3253
3262
|
if (typeof window !== "undefined") {
|
|
3254
3263
|
window.addEventListener("message", this.boundHandleMessage);
|
|
@@ -3335,6 +3344,7 @@ var CimplifyElement = class {
|
|
|
3335
3344
|
const iframe = document.createElement("iframe");
|
|
3336
3345
|
const url = new URL(`${this.linkUrl}/elements/${this.type}`);
|
|
3337
3346
|
url.searchParams.set("businessId", resolvedBusinessId);
|
|
3347
|
+
url.searchParams.set("nonce", this.nonce);
|
|
3338
3348
|
if (this.options.prefillEmail) url.searchParams.set("email", this.options.prefillEmail);
|
|
3339
3349
|
if (this.options.mode) url.searchParams.set("mode", this.options.mode);
|
|
3340
3350
|
iframe.src = url.toString();
|
|
@@ -3370,9 +3380,14 @@ var CimplifyElement = class {
|
|
|
3370
3380
|
if (!isAllowedOrigin(event.origin)) {
|
|
3371
3381
|
return;
|
|
3372
3382
|
}
|
|
3373
|
-
const
|
|
3374
|
-
if (
|
|
3375
|
-
return;
|
|
3383
|
+
const data = event.data;
|
|
3384
|
+
if (data?.nonce) {
|
|
3385
|
+
if (data.nonce !== this.nonce) return;
|
|
3386
|
+
} else {
|
|
3387
|
+
const iframeWindow = this.iframe?.contentWindow;
|
|
3388
|
+
if (iframeWindow && event.source && event.source !== iframeWindow) {
|
|
3389
|
+
return;
|
|
3390
|
+
}
|
|
3376
3391
|
}
|
|
3377
3392
|
const message = parseIframeMessage(event.data);
|
|
3378
3393
|
if (!message) return;
|
package/dist/react.mjs
CHANGED
|
@@ -377,6 +377,7 @@ function CimplifyCheckout({
|
|
|
377
377
|
businessId,
|
|
378
378
|
cartId,
|
|
379
379
|
locationId,
|
|
380
|
+
linkUrl,
|
|
380
381
|
orderTypes,
|
|
381
382
|
enrollInLink = true,
|
|
382
383
|
onComplete,
|
|
@@ -515,7 +516,8 @@ function CimplifyCheckout({
|
|
|
515
516
|
return;
|
|
516
517
|
}
|
|
517
518
|
const elements = client.elements(resolvedBusinessId, {
|
|
518
|
-
appearance: initialAppearanceRef.current
|
|
519
|
+
appearance: initialAppearanceRef.current,
|
|
520
|
+
linkUrl
|
|
519
521
|
});
|
|
520
522
|
elementsRef.current = elements;
|
|
521
523
|
const auth = elements.create("auth");
|
|
@@ -2873,6 +2875,12 @@ function toCheckoutError(code, message, recoverable) {
|
|
|
2873
2875
|
};
|
|
2874
2876
|
}
|
|
2875
2877
|
var DEFAULT_LINK_URL = "https://link.cimplify.io";
|
|
2878
|
+
function generateNonce() {
|
|
2879
|
+
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
2880
|
+
return crypto.randomUUID().replace(/-/g, "").slice(0, 16);
|
|
2881
|
+
}
|
|
2882
|
+
return Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2);
|
|
2883
|
+
}
|
|
2876
2884
|
function isAllowedOrigin(origin) {
|
|
2877
2885
|
try {
|
|
2878
2886
|
const url = new URL(origin);
|
|
@@ -3247,6 +3255,7 @@ var CimplifyElement = class {
|
|
|
3247
3255
|
this.linkUrl = linkUrl;
|
|
3248
3256
|
this.options = options;
|
|
3249
3257
|
this.parent = parent;
|
|
3258
|
+
this.nonce = generateNonce();
|
|
3250
3259
|
this.boundHandleMessage = this.handleMessage.bind(this);
|
|
3251
3260
|
if (typeof window !== "undefined") {
|
|
3252
3261
|
window.addEventListener("message", this.boundHandleMessage);
|
|
@@ -3333,6 +3342,7 @@ var CimplifyElement = class {
|
|
|
3333
3342
|
const iframe = document.createElement("iframe");
|
|
3334
3343
|
const url = new URL(`${this.linkUrl}/elements/${this.type}`);
|
|
3335
3344
|
url.searchParams.set("businessId", resolvedBusinessId);
|
|
3345
|
+
url.searchParams.set("nonce", this.nonce);
|
|
3336
3346
|
if (this.options.prefillEmail) url.searchParams.set("email", this.options.prefillEmail);
|
|
3337
3347
|
if (this.options.mode) url.searchParams.set("mode", this.options.mode);
|
|
3338
3348
|
iframe.src = url.toString();
|
|
@@ -3368,9 +3378,14 @@ var CimplifyElement = class {
|
|
|
3368
3378
|
if (!isAllowedOrigin(event.origin)) {
|
|
3369
3379
|
return;
|
|
3370
3380
|
}
|
|
3371
|
-
const
|
|
3372
|
-
if (
|
|
3373
|
-
return;
|
|
3381
|
+
const data = event.data;
|
|
3382
|
+
if (data?.nonce) {
|
|
3383
|
+
if (data.nonce !== this.nonce) return;
|
|
3384
|
+
} else {
|
|
3385
|
+
const iframeWindow = this.iframe?.contentWindow;
|
|
3386
|
+
if (iframeWindow && event.source && event.source !== iframeWindow) {
|
|
3387
|
+
return;
|
|
3388
|
+
}
|
|
3374
3389
|
}
|
|
3375
3390
|
const message = parseIframeMessage(event.data);
|
|
3376
3391
|
if (!message) return;
|