@returnflows/shop-overlay 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/types/api/types.d.ts +1 -0
- package/dist/types/widget/components/drawer/product/product-attributes.d.ts +2 -1
- package/dist/types/widget/lib/hooks/common/use-async-state.d.ts +1 -1
- package/dist/types/widget/lib/hooks/context/use-currency.d.ts +1 -1
- package/dist/types/widget/lib/types.d.ts +1 -145
- package/dist/types/widget/lib/utils/api.d.ts +1 -1
- package/dist/types/widget/lib/utils/helpers.d.ts +1 -0
- package/dist/types/widget/lib/utils/initialization/dataset.d.ts +1 -2
- package/dist/types/widget/lib/utils/initialization/settings.d.ts +7 -0
- package/package.json +1 -1
|
@@ -6,9 +6,10 @@ export interface ProductAttributesAttributes {
|
|
|
6
6
|
compareAtPrice: number | null | undefined;
|
|
7
7
|
quantity: number;
|
|
8
8
|
href?: string;
|
|
9
|
+
exchangeRate?: number;
|
|
9
10
|
}
|
|
10
11
|
interface ProductAttributesProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "title">, ProductAttributesAttributes {
|
|
11
12
|
showQuantity?: boolean;
|
|
12
13
|
}
|
|
13
|
-
declare const _default: ({ title, variantTitle, pending, price, compareAtPrice, className, quantity, href, showQuantity, ...props }: ProductAttributesProps) => import("preact").JSX.Element;
|
|
14
|
+
declare const _default: ({ title, variantTitle, pending, price, compareAtPrice, className, quantity, href, showQuantity, exchangeRate, ...props }: ProductAttributesProps) => import("preact").JSX.Element;
|
|
14
15
|
export default _default;
|
|
@@ -32,7 +32,7 @@ type TUseAsyncStateProps<T, P = undefined> = P extends undefined ? TUseAsyncStat
|
|
|
32
32
|
export interface IUseAsyncStateReturn<T, P = undefined> {
|
|
33
33
|
value: IAsyncState<T>;
|
|
34
34
|
set: React.Dispatch<React.SetStateAction<IAsyncState<T>>>;
|
|
35
|
-
query: P extends undefined ? () => Promise<T> : (params: P) => Promise<T>;
|
|
35
|
+
query: P extends undefined ? () => Promise<T | null> : (params: P) => Promise<T | null>;
|
|
36
36
|
initialFetch: boolean;
|
|
37
37
|
count: number;
|
|
38
38
|
}
|
|
@@ -6,7 +6,7 @@ interface ICurrencyFormatOptions extends Omit<NumberFormatOptions, "style" | "cu
|
|
|
6
6
|
}
|
|
7
7
|
declare const useCurrency: (hookOptions?: ICurrencyFormatOptions) => {
|
|
8
8
|
format: (value: number | string, options?: ICurrencyFormatOptions) => string;
|
|
9
|
-
applyExchangeRate: (value: number) => number;
|
|
9
|
+
applyExchangeRate: (value: number, exchangeRate?: number) => number;
|
|
10
10
|
currency: string;
|
|
11
11
|
};
|
|
12
12
|
export default useCurrency;
|
|
@@ -227,150 +227,7 @@ export interface ShopifyErrorResponse {
|
|
|
227
227
|
message: string;
|
|
228
228
|
description: string;
|
|
229
229
|
}
|
|
230
|
-
export
|
|
231
|
-
variantId: string | undefined;
|
|
232
|
-
productId: string;
|
|
233
|
-
productTitle: string;
|
|
234
|
-
price: number;
|
|
235
|
-
compareAtPrice: number | null;
|
|
236
|
-
coverage: {
|
|
237
|
-
originalProductId: string;
|
|
238
|
-
originalVariantId: string;
|
|
239
|
-
quantityCovered: number;
|
|
240
|
-
originalUnitPrice: number;
|
|
241
|
-
exchangeUnitPrice: number;
|
|
242
|
-
coveredAmount: number;
|
|
243
|
-
} | null;
|
|
244
|
-
}
|
|
245
|
-
export interface CalculationLineItem {
|
|
246
|
-
id: string;
|
|
247
|
-
lineItemId: string;
|
|
248
|
-
variantId: string;
|
|
249
|
-
productId: string;
|
|
250
|
-
quantity: number;
|
|
251
|
-
lineItemDistributionKey: number;
|
|
252
|
-
action: "NOT_DECIDED" | "REFUND" | "EXCHANGE" | "SWAP" | "GIFTCARD";
|
|
253
|
-
originalPrice: number;
|
|
254
|
-
price: number;
|
|
255
|
-
discountedPrice: number;
|
|
256
|
-
originalTotal: number;
|
|
257
|
-
total: number;
|
|
258
|
-
discountedTotal: number;
|
|
259
|
-
metafield: {
|
|
260
|
-
namespace: unknown;
|
|
261
|
-
key: unknown;
|
|
262
|
-
value: unknown;
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
export interface CalculationResponse {
|
|
266
|
-
percentageOfReturn: number;
|
|
267
|
-
returnLabelPrice: number;
|
|
268
|
-
giftCardBonusAmount: number;
|
|
269
|
-
refundMethods: {
|
|
270
|
-
refund: number;
|
|
271
|
-
giftcard: number;
|
|
272
|
-
exchange: number;
|
|
273
|
-
};
|
|
274
|
-
distributionKeysByAction: {
|
|
275
|
-
REFUND: number;
|
|
276
|
-
EXCHANGE: number;
|
|
277
|
-
GIFTCARD: number;
|
|
278
|
-
};
|
|
279
|
-
shipping: {
|
|
280
|
-
amount: number;
|
|
281
|
-
amountInCurrency: number;
|
|
282
|
-
originalOrderShipping: number;
|
|
283
|
-
};
|
|
284
|
-
orderDiscounts: Array<unknown>;
|
|
285
|
-
discountSummary: {
|
|
286
|
-
originalDiscountTotal: number;
|
|
287
|
-
adjustedDiscountTotal: number;
|
|
288
|
-
appliedToReturnSubtotal: number;
|
|
289
|
-
hasDiscounts: boolean;
|
|
290
|
-
hasAdjustedDiscounts: boolean;
|
|
291
|
-
discountAppliedToExchange: boolean;
|
|
292
|
-
discountAddedToReturnSubtotal: boolean;
|
|
293
|
-
shippingRefundAppliedToReturnSubtotal: boolean;
|
|
294
|
-
};
|
|
295
|
-
lineItems: Array<CalculationLineItem>;
|
|
296
|
-
exchange: {
|
|
297
|
-
originalTotal: number;
|
|
298
|
-
newTotal: number;
|
|
299
|
-
priceDifference: number;
|
|
300
|
-
isUpsell: boolean;
|
|
301
|
-
additionalCharge: number;
|
|
302
|
-
totalCoveredAmount: number;
|
|
303
|
-
discountSummary: {
|
|
304
|
-
originalDiscountTotal: number;
|
|
305
|
-
adjustedDiscountTotal: number;
|
|
306
|
-
appliedToReturnSubtotal: number;
|
|
307
|
-
hasDiscounts: boolean;
|
|
308
|
-
hasAdjustedDiscounts: boolean;
|
|
309
|
-
discountAppliedToExchange: boolean;
|
|
310
|
-
discountAddedToReturnSubtotal: boolean;
|
|
311
|
-
shippingRefundAppliedToReturnSubtotal: boolean;
|
|
312
|
-
};
|
|
313
|
-
exchangeDetails: Array<CalculationExchangeProduct>;
|
|
314
|
-
};
|
|
315
|
-
currency: {
|
|
316
|
-
localCurrency: string;
|
|
317
|
-
shopCurrency: string;
|
|
318
|
-
exchangeRate: number;
|
|
319
|
-
};
|
|
320
|
-
options: {
|
|
321
|
-
coverPriceChange: boolean;
|
|
322
|
-
orderDiscountMatch: boolean;
|
|
323
|
-
productDiscountMatch: boolean;
|
|
324
|
-
giftCardBonusPercentage: number;
|
|
325
|
-
refundOriginalShippingType: string;
|
|
326
|
-
};
|
|
327
|
-
returnSubtotal: number;
|
|
328
|
-
orderSubtotal: number;
|
|
329
|
-
preferedLabelDeduction: string;
|
|
330
|
-
total: number;
|
|
331
|
-
calculatedAt: string;
|
|
332
|
-
detailedBreakdown: {
|
|
333
|
-
originalOrder: {
|
|
334
|
-
subtotal: number;
|
|
335
|
-
shipping: number;
|
|
336
|
-
discounts: Array<unknown>;
|
|
337
|
-
total: number;
|
|
338
|
-
};
|
|
339
|
-
return: {
|
|
340
|
-
subtotal: {
|
|
341
|
-
items: number;
|
|
342
|
-
returnLabelPrice: number;
|
|
343
|
-
shippingRefund: number;
|
|
344
|
-
discounts: Array<unknown>;
|
|
345
|
-
total: number;
|
|
346
|
-
};
|
|
347
|
-
refundMethods: {
|
|
348
|
-
refund: {
|
|
349
|
-
amount: number;
|
|
350
|
-
description: string;
|
|
351
|
-
};
|
|
352
|
-
giftcard: {
|
|
353
|
-
baseAmount: number;
|
|
354
|
-
bonusAmount: number;
|
|
355
|
-
bonusPercentage: number;
|
|
356
|
-
totalAmount: number;
|
|
357
|
-
};
|
|
358
|
-
exchange: {
|
|
359
|
-
amount: number;
|
|
360
|
-
priceDifference: number;
|
|
361
|
-
finalAmount: number;
|
|
362
|
-
};
|
|
363
|
-
};
|
|
364
|
-
total: number;
|
|
365
|
-
};
|
|
366
|
-
preferedLabelDeduction: string;
|
|
367
|
-
currency: {
|
|
368
|
-
localCurrency: string;
|
|
369
|
-
shopCurrency: string;
|
|
370
|
-
exchangeRate: number;
|
|
371
|
-
};
|
|
372
|
-
};
|
|
373
|
-
}
|
|
230
|
+
export type { CalculationExchangeProduct, CalculationLineItem, CalculationResponse } from "../../api/types";
|
|
374
231
|
export declare enum WidgetViewState {
|
|
375
232
|
Collapsed = "COLLAPSED",
|
|
376
233
|
Open = "OPEN"
|
|
@@ -379,4 +236,3 @@ export declare enum ReturnViewState {
|
|
|
379
236
|
Collapsed = "COLLAPSED",
|
|
380
237
|
Open = "OPEN"
|
|
381
238
|
}
|
|
382
|
-
export {};
|
|
@@ -15,7 +15,7 @@ interface FetchAPIOptions extends Omit<RequestInit, "body" | "method"> {
|
|
|
15
15
|
params?: Record<string, string | number | boolean> | URLSearchParams;
|
|
16
16
|
clientStorage?: FetchStoreOptions;
|
|
17
17
|
}
|
|
18
|
-
export declare function apiQuery<T>(path: string
|
|
18
|
+
export declare function apiQuery<T>(path: `/${string}`, { clientStorage: storageOptions, ...init }?: FetchAPIOptions): Promise<T>;
|
|
19
19
|
export declare function getCalculation({ orderId, cart, lineItems }: CalculationParams, labelCount: number): Promise<CalculationResponse>;
|
|
20
20
|
export declare function getShopOverlayData(isFirstLoad: boolean, internalReturnId: string, lineIds: string): Promise<ShopOverlayData>;
|
|
21
21
|
export type ProcessOrderInitializationReturn = {
|
|
@@ -21,4 +21,5 @@ export declare function secondsToMilliseconds(seconds: number): number;
|
|
|
21
21
|
export declare function setNestedValue<T>(obj: Record<string, unknown>, path: string, value: T): T;
|
|
22
22
|
export declare function getResolvedSearchParams(): URLSearchParams;
|
|
23
23
|
export declare function resolveSetStateAction<T>(action: React.SetStateAction<T>, currentState: T): T;
|
|
24
|
+
export default function deepClone<T>(value: T): T;
|
|
24
25
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { InitOptions, InitResult
|
|
1
|
+
import { InitOptions, InitResult } from "./types";
|
|
2
2
|
export declare function isDOMStringMap(value: DOMStringMap | InitOptions): value is DOMStringMap;
|
|
3
3
|
export declare function parseScriptDataset(dataset: DOMStringMap): InitOptions;
|
|
4
|
-
export declare function getSettingsFromScript(): WidgetSettings | null;
|
|
5
4
|
export declare function prepareInitializationOptions(dataset: DOMStringMap | InitOptions): Promise<InitResult>;
|
package/package.json
CHANGED