@tapcart/mobile-components 0.7.36 → 0.7.38
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/components/hooks/use-customer.d.ts +10 -0
- package/dist/components/hooks/use-customer.d.ts.map +1 -0
- package/dist/components/hooks/use-customer.js +24 -0
- package/dist/components/hooks/use-reviews.d.ts.map +1 -1
- package/dist/components/hooks/use-reviews.js +9 -0
- package/dist/components/libs/sort-filter/custom-search.d.ts +6 -0
- package/dist/components/libs/sort-filter/custom-search.d.ts.map +1 -1
- package/dist/components/libs/sort-filter/custom-search.js +6 -2
- package/dist/components/libs/sort-filter/search-integration.d.ts +1 -1
- package/dist/components/libs/sort-filter/search-integration.d.ts.map +1 -1
- package/dist/components/libs/sort-filter/search-integration.js +4 -2
- package/dist/components/ui/apple-pay-button.d.ts +24 -0
- package/dist/components/ui/apple-pay-button.d.ts.map +1 -0
- package/dist/components/ui/apple-pay-button.js +122 -0
- package/dist/components/ui/chip.d.ts +4 -0
- package/dist/components/ui/chip.d.ts.map +1 -1
- package/dist/components/ui/chip.js +3 -2
- package/dist/components/ui/icon.d.ts +2 -1
- package/dist/components/ui/icon.d.ts.map +1 -1
- package/dist/components/ui/icon.js +9 -4
- package/dist/components/ui/quantity-picker.d.ts +5 -3
- package/dist/components/ui/quantity-picker.d.ts.map +1 -1
- package/dist/components/ui/quantity-picker.js +4 -4
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +4 -0
- package/dist/styles.css +15 -0
- package/package.json +3 -2
- package/dist/components/ThemeProvider.d.ts +0 -3
- package/dist/components/ThemeProvider.d.ts.map +0 -1
- package/dist/components/ThemeProvider.js +0 -18
- package/dist/components/ThemeToggle.d.ts +0 -2
- package/dist/components/ThemeToggle.d.ts.map +0 -1
- package/dist/components/ThemeToggle.js +0 -8
- package/dist/components/ui/input.d.ts +0 -17
- package/dist/components/ui/input.d.ts.map +0 -1
- package/dist/components/ui/input.js +0 -35
- package/dist/components/ui/product-grid.d.ts +0 -15
- package/dist/components/ui/product-grid.d.ts.map +0 -1
- package/dist/components/ui/product-grid.js +0 -22
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Customer = {
|
|
2
|
+
isAuthenticated: boolean;
|
|
3
|
+
};
|
|
4
|
+
type UseCustomerProps = {};
|
|
5
|
+
type UseCustomerReturn = {
|
|
6
|
+
customer: Customer;
|
|
7
|
+
};
|
|
8
|
+
export declare const useCustomer: (props: UseCustomerProps | null) => UseCustomerReturn;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=use-customer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-customer.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-customer.ts"],"names":[],"mappings":"AAWA,KAAK,QAAQ,GAAG;IACd,eAAe,EAAE,OAAO,CAAA;CACzB,CAAA;AAGD,KAAK,gBAAgB,GAAG,EAAE,CAAA;AAE1B,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,QAAQ,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,UACf,gBAAgB,GAAG,IAAI,KAC7B,iBAuBF,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
// @ts-ignore -- webbridge-react is not typed (yet)
|
|
4
|
+
import { useActions } from "@tapcart/webbridge-react";
|
|
5
|
+
export const useCustomer = (props) => {
|
|
6
|
+
const [isAuthenticated, setIsAuthenticated] = useState(false);
|
|
7
|
+
const [customer, setCustomer] = useState({});
|
|
8
|
+
const actions = useActions();
|
|
9
|
+
// verify customer
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
try {
|
|
12
|
+
// webbridge method to get customerIdentity
|
|
13
|
+
actions.getCustomerIdentity(null, {
|
|
14
|
+
onSuccess: (user) => setIsAuthenticated(!!(user === null || user === void 0 ? void 0 : user.email)),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
console.log("unable to get customer identity ", e);
|
|
19
|
+
}
|
|
20
|
+
}, [actions]);
|
|
21
|
+
return {
|
|
22
|
+
customer: Object.assign({ isAuthenticated }, customer),
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-reviews.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-reviews.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAGtF,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,QAAQ,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;IAClB,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,eAAe,CAAC;IACjF,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,iBAAiB,GAAG,cAAc,GAAG,gBAAgB,GAAG,IAAI,CAAA;IAClE,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;IAClB,eAAe,CAAC,EAAE,GAAG,CAAA;IACrB,oBAAoB,CAAC,EAAE,GAAG,CAAA;CAC3B,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AI,CAAC,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;CACtC,CAAA;AAGD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,wBAAwB,CAyI1F"}
|
|
@@ -49,6 +49,15 @@ const mockStarDistribution = {
|
|
|
49
49
|
5: 0,
|
|
50
50
|
};
|
|
51
51
|
export function useReviews(props) {
|
|
52
|
+
if (props && !props.provider) {
|
|
53
|
+
return {
|
|
54
|
+
data: null,
|
|
55
|
+
error: null,
|
|
56
|
+
isLoading: false,
|
|
57
|
+
reviewsMockData,
|
|
58
|
+
mockStarDistribution,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
52
61
|
let url = null;
|
|
53
62
|
if (props) {
|
|
54
63
|
const { baseURL, productId, provider, dataType, searchText, ratings, topics, sortBy, ascending, perPage, page, limit } = props;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { KMP } from "./kmp";
|
|
2
2
|
import { FilterCategory } from "../../../components/libs/sort-filter/search-integration";
|
|
3
3
|
import { ReadonlyURLSearchParams } from "next/navigation";
|
|
4
|
+
import { Integration } from "app-studio-types";
|
|
4
5
|
export declare class CustomSearch extends KMP {
|
|
6
|
+
private integration;
|
|
7
|
+
constructor({ integration }: {
|
|
8
|
+
integration: Integration;
|
|
9
|
+
});
|
|
5
10
|
convertFilterCategoriesToSearchParams: (filters: FilterCategory[], searchParams: ReadonlyURLSearchParams) => string;
|
|
11
|
+
isDynamicFilterSupported: () => any;
|
|
6
12
|
}
|
|
7
13
|
//# sourceMappingURL=custom-search.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-search.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/custom-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAEL,cAAc,EACf,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"custom-search.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/custom-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAEL,cAAc,EACf,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,qBAAa,YAAa,SAAQ,GAAG;IACnC,OAAO,CAAC,WAAW,CAAa;gBAEpB,EAAE,WAAW,EAAE,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAG;IAK1D,qCAAqC,YAC1B,cAAc,EAAE,gBACX,uBAAuB,KACpC,MAAM,CA2BR;IAED,wBAAwB,YAEvB;CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { KMP } from "./kmp";
|
|
2
2
|
export class CustomSearch extends KMP {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(
|
|
3
|
+
constructor({ integration }) {
|
|
4
|
+
super();
|
|
5
5
|
this.convertFilterCategoriesToSearchParams = (filters, searchParams) => {
|
|
6
6
|
const filtersToApply = filters.reduce((acc, it) => {
|
|
7
7
|
const inner = it.filters.reduce((innerAcc, f) => {
|
|
@@ -26,5 +26,9 @@ export class CustomSearch extends KMP {
|
|
|
26
26
|
}
|
|
27
27
|
return newParams.toString();
|
|
28
28
|
};
|
|
29
|
+
this.isDynamicFilterSupported = () => {
|
|
30
|
+
return this.integration['isDynamicFilterSupported'] || false;
|
|
31
|
+
};
|
|
32
|
+
this.integration = integration;
|
|
29
33
|
}
|
|
30
34
|
}
|
|
@@ -56,5 +56,5 @@ export interface SearchIntegration {
|
|
|
56
56
|
export declare const createIntegrationLookup: (integrations: Integration[]) => Record<string, Integration>;
|
|
57
57
|
export declare const isSearchProvider: (integrationLookup: Record<string, Integration>, searchIntegrationNames: string[]) => boolean;
|
|
58
58
|
export declare const searchIntegrationProvider: (integrations: Integration[]) => SearchIntegration;
|
|
59
|
-
export declare const isDynamicFiltersSupported: (searchIntegration: SearchIntegration | null) =>
|
|
59
|
+
export declare const isDynamicFiltersSupported: (searchIntegration: SearchIntegration | null) => any;
|
|
60
60
|
//# sourceMappingURL=search-integration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-integration.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/search-integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAUzD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,UAAU,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,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,
|
|
1
|
+
{"version":3,"file":"search-integration.d.ts","sourceRoot":"","sources":["../../../../components/libs/sort-filter/search-integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAUzD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,UAAU,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,gBAAgB,EAAE,cAAc,EAAE,GAAG,SAAS,GAAG,IAAI,CAAA;IACrD,iBAAiB,EAAE,eAAe,EAAE,GAAG,SAAS,GAAG,IAAI,CAAA;IACvD,QAAQ,CAAC,EAAE,GAAG,CAAA;CACf,CAAA;AAED,MAAM,WAAW,iBAAiB;IAIhC,qBAAqB,IAAI,MAAM,CAAA;IAE/B,6BAA6B,CAAC,EAC5B,YAAY,EACZ,WAAW,GACZ,EAAE;QACD,YAAY,EAAE,uBAAuB,CAAA;QACrC,WAAW,EAAE,mBAAmB,EAAE,CAAA;KACnC,GAAG,mBAAmB,GAAG,IAAI,CAAA;IAK9B,yBAAyB,CAAC,EACxB,UAAU,EACV,cAAc,GACf,EAAE;QACD,UAAU,EAAE,mBAAmB,GAAG,SAAS,CAAA;QAC3C,cAAc,EAAE,uBAAuB,CAAA;KACxC,GAAG,eAAe,CAAA;IAKnB,qCAAqC,CACnC,OAAO,EAAE,cAAc,EAAE,EACzB,YAAY,EAAE,uBAAuB,GACpC,MAAM,CAAA;CACV;AAED,eAAO,MAAM,uBAAuB,iBAAkB,WAAW,EAAE,gCAKlE,CAAA;AAED,eAAO,MAAM,gBAAgB,sBACR,OAAO,MAAM,EAAE,WAAW,CAAC,0BACtB,MAAM,EAAE,KAC/B,OAEF,CAAA;AAED,eAAO,MAAM,yBAAyB,iBACtB,WAAW,EAAE,KAC1B,iBAiCF,CAAA;AAED,eAAO,MAAM,yBAAyB,sBACjB,iBAAiB,GAAG,IAAI,QAMkE,CAAA"}
|
|
@@ -35,7 +35,8 @@ export const searchIntegrationProvider = (integrations) => {
|
|
|
35
35
|
case isSearchProvider(integrationLookup, ["searchanise"]):
|
|
36
36
|
return new KMP();
|
|
37
37
|
case isSearchProvider(integrationLookup, ["constructor-io"]):
|
|
38
|
-
|
|
38
|
+
const constructorIntegrationInfo = integrationLookup["constructor-io"];
|
|
39
|
+
return new CustomSearch({ integration: constructorIntegrationInfo });
|
|
39
40
|
default:
|
|
40
41
|
return new ShopifySearchAndDiscovery();
|
|
41
42
|
}
|
|
@@ -43,4 +44,5 @@ export const searchIntegrationProvider = (integrations) => {
|
|
|
43
44
|
export const isDynamicFiltersSupported = (searchIntegration) => searchIntegration instanceof ShopifySearchAndDiscovery ||
|
|
44
45
|
searchIntegration instanceof BeyondSearch ||
|
|
45
46
|
searchIntegration instanceof NostoSearch ||
|
|
46
|
-
searchIntegration instanceof FastSimonSearch
|
|
47
|
+
searchIntegration instanceof FastSimonSearch ||
|
|
48
|
+
(searchIntegration instanceof CustomSearch && searchIntegration.isDynamicFilterSupported());
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="applepayjs" />
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type ApplePayButtonType = 'plain' | 'add-money' | 'book' | 'buy' | 'check-out' | 'continue' | 'contribute' | 'donate' | 'order' | 'pay' | 'reload' | 'rent' | 'set-up' | 'subscribe' | 'support' | 'tip' | 'top-up';
|
|
4
|
+
export type ApplePayButtonStyle = 'black' | 'white' | 'white-outline';
|
|
5
|
+
export interface ApplePayButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
|
+
displayName: string;
|
|
7
|
+
amount: number;
|
|
8
|
+
startSessionURL: string;
|
|
9
|
+
appId: string;
|
|
10
|
+
domainName: string;
|
|
11
|
+
countryCode?: string;
|
|
12
|
+
currencyCode?: string;
|
|
13
|
+
merchantCapabilities?: ApplePayJS.ApplePayMerchantCapability[];
|
|
14
|
+
supportedNetworks?: string[];
|
|
15
|
+
buttonType?: ApplePayButtonType;
|
|
16
|
+
buttonStyle?: ApplePayButtonStyle;
|
|
17
|
+
onPaymentAuthorized?: (paymentData: ApplePayJS.ApplePayPayment) => void;
|
|
18
|
+
}
|
|
19
|
+
declare const ApplePayButton: {
|
|
20
|
+
({ displayName, amount, startSessionURL, appId, domainName, countryCode, currencyCode, merchantCapabilities, supportedNetworks, buttonType, buttonStyle, onPaymentAuthorized, }: ApplePayButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
displayName: string;
|
|
22
|
+
};
|
|
23
|
+
export { ApplePayButton };
|
|
24
|
+
//# sourceMappingURL=apple-pay-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apple-pay-button.d.ts","sourceRoot":"","sources":["../../../components/ui/apple-pay-button.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE3N,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,OAAO,GAAG,eAAe,CAAA;AAErE,MAAM,WAAW,mBACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,UAAU,CAAC,0BAA0B,EAAE,CAAC;IAC/D,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,eAAe,KAAK,IAAI,CAAC;CACzE;AAED,QAAA,MAAM,cAAc;qLAcf,mBAAmB;;CA2IvB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
import ApplePayButtonComponent from 'apple-pay-button';
|
|
14
|
+
const ApplePayButton = ({ displayName, amount, startSessionURL, appId, domainName, countryCode = 'US', currencyCode = 'USD', merchantCapabilities = ["supports3DS"], supportedNetworks = ["visa", "masterCard", "amex", "discover"], buttonType = 'plain', buttonStyle = 'white-outline', onPaymentAuthorized, }) => {
|
|
15
|
+
const [paymentDataResult, setPaymentDataResult] = React.useState("");
|
|
16
|
+
const onClick = () => {
|
|
17
|
+
const applePayRequest = {
|
|
18
|
+
countryCode,
|
|
19
|
+
currencyCode,
|
|
20
|
+
merchantCapabilities,
|
|
21
|
+
supportedNetworks,
|
|
22
|
+
total: {
|
|
23
|
+
label: displayName,
|
|
24
|
+
type: "final",
|
|
25
|
+
amount: amount.toString(),
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const session = new ApplePaySession(3, applePayRequest);
|
|
29
|
+
handleEventsForApplePay(session);
|
|
30
|
+
session.begin();
|
|
31
|
+
};
|
|
32
|
+
const defaultFetcher = (url, body) => fetch(url, {
|
|
33
|
+
method: body ? "POST" : "GET",
|
|
34
|
+
headers: {
|
|
35
|
+
"Content-Type": "application/json",
|
|
36
|
+
},
|
|
37
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
38
|
+
}).then((res) => res.json());
|
|
39
|
+
const validateMerchant = (validationURL, appId, domainName, displayName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
let url = startSessionURL;
|
|
41
|
+
let body = {
|
|
42
|
+
validationURL,
|
|
43
|
+
appId,
|
|
44
|
+
domainName,
|
|
45
|
+
displayName
|
|
46
|
+
};
|
|
47
|
+
console.log("request body", body);
|
|
48
|
+
const response = yield defaultFetcher(url, body);
|
|
49
|
+
return response.data;
|
|
50
|
+
});
|
|
51
|
+
const handleEventsForApplePay = (session) => {
|
|
52
|
+
session.onvalidatemerchant = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
+
const response = yield validateMerchant(event.validationURL, appId, domainName, displayName);
|
|
54
|
+
if (response) {
|
|
55
|
+
session.completeMerchantValidation(response);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
console.error("Error during validating merchant");
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
session.onpaymentmethodselected = (event) => {
|
|
62
|
+
const update = {
|
|
63
|
+
newTotal: {
|
|
64
|
+
label: displayName,
|
|
65
|
+
type: "final",
|
|
66
|
+
amount: amount.toString(),
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
session.completePaymentMethodSelection(update);
|
|
70
|
+
};
|
|
71
|
+
session.onshippingmethodselected = (event) => {
|
|
72
|
+
const update = {
|
|
73
|
+
newTotal: {
|
|
74
|
+
label: displayName,
|
|
75
|
+
type: "final",
|
|
76
|
+
amount: amount.toString(),
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
session.completeShippingMethodSelection(update);
|
|
80
|
+
};
|
|
81
|
+
session.onshippingcontactselected = (event) => {
|
|
82
|
+
const update = {
|
|
83
|
+
newTotal: {
|
|
84
|
+
label: displayName,
|
|
85
|
+
type: "final",
|
|
86
|
+
amount: amount.toString(),
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
session.completeShippingContactSelection(update);
|
|
90
|
+
};
|
|
91
|
+
session.onpaymentauthorized = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
92
|
+
const paymentData = event.payment;
|
|
93
|
+
if (onPaymentAuthorized) { // Call the callback if provided
|
|
94
|
+
onPaymentAuthorized(paymentData);
|
|
95
|
+
}
|
|
96
|
+
if (paymentData.token) {
|
|
97
|
+
const paymentDataJson = JSON.stringify(paymentData.token, null, 2);
|
|
98
|
+
console.log("paymentData", paymentDataJson);
|
|
99
|
+
setPaymentDataResult(paymentDataJson);
|
|
100
|
+
const result = {
|
|
101
|
+
status: ApplePaySession.STATUS_SUCCESS,
|
|
102
|
+
};
|
|
103
|
+
session.completePayment(result);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
const result = {
|
|
107
|
+
status: ApplePaySession.STATUS_FAILURE,
|
|
108
|
+
};
|
|
109
|
+
session.completePayment(result);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
session.oncancel = (event) => {
|
|
113
|
+
console.log("Session Cancelled.");
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
return (_jsxs("div", { children: [_jsx("div", Object.assign({ className: "flex flex-row justify-center items-center pt-40" }, { children: _jsx(ApplePayButtonComponent, { onClick: onClick, style: {
|
|
117
|
+
height: "48px",
|
|
118
|
+
borderRadius: '4px',
|
|
119
|
+
}, type: buttonType, buttonStyle: buttonStyle }) })), _jsx("div", Object.assign({ className: "w-100 overflow-auto" }, { children: _jsx("pre", Object.assign({ className: "whitespace-pre-wrap break-words" }, { children: paymentDataResult })) }))] }));
|
|
120
|
+
};
|
|
121
|
+
ApplePayButton.displayName = "ApplePayButton";
|
|
122
|
+
export { ApplePayButton };
|
|
@@ -7,7 +7,9 @@ declare const chipVariants: (props?: ({
|
|
|
7
7
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
8
|
type ChipProps = React.ComponentPropsWithoutRef<"div"> & VariantProps<typeof chipVariants> & {
|
|
9
9
|
icon?: React.ElementType;
|
|
10
|
+
iconColor?: string;
|
|
10
11
|
iconPosition?: "left" | "right";
|
|
12
|
+
iconUrl?: string;
|
|
11
13
|
onChipClick?: () => void;
|
|
12
14
|
onIconClick?: () => void;
|
|
13
15
|
};
|
|
@@ -17,7 +19,9 @@ declare const Chip: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps
|
|
|
17
19
|
iconPosition?: "left" | "right" | "default" | null | undefined;
|
|
18
20
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & {
|
|
19
21
|
icon?: React.ElementType<any> | undefined;
|
|
22
|
+
iconColor?: string | undefined;
|
|
20
23
|
iconPosition?: "left" | "right" | undefined;
|
|
24
|
+
iconUrl?: string | undefined;
|
|
21
25
|
onChipClick?: (() => void) | undefined;
|
|
22
26
|
onIconClick?: (() => void) | undefined;
|
|
23
27
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../../components/ui/chip.tsx"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,KAAsC,MAAM,OAAO,CAAA;AAG1D,QAAA,MAAM,YAAY;;;;mFAwBjB,CAAA;AAED,KAAK,SAAS,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,GACpD,YAAY,CAAC,OAAO,YAAY,CAAC,GAAG;IAClC,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC/B,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;CACzB,CAAA;AAEH,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../../components/ui/chip.tsx"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,KAAsC,MAAM,OAAO,CAAA;AAG1D,QAAA,MAAM,YAAY;;;;mFAwBjB,CAAA;AAED,KAAK,SAAS,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,GACpD,YAAY,CAAC,OAAO,YAAY,CAAC,GAAG;IAClC,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;CACzB,CAAA;AAEH,QAAA,MAAM,IAAI;;;;;;;;;yBAJc,IAAI;yBACJ,IAAI;wCAgE3B,CAAA;AAGD,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,CAAA;IACzC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;CAC9C,CAAA;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAkD/C,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,KAAK,kBAAkB,EAAE,CAAA"}
|
|
@@ -38,14 +38,15 @@ const chipVariants = cva("inline-flex items-center justify-center rounded border
|
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
40
|
const Chip = React.forwardRef((_a, ref) => {
|
|
41
|
-
var { className, variant, direction, children, iconPosition, onChipClick, onIconClick } = _a, props = __rest(_a, ["className", "variant", "direction", "children", "iconPosition", "onChipClick", "onIconClick"]);
|
|
41
|
+
var { className, variant, direction, children, iconPosition, iconColor = "coreColors-secondaryIcon", iconUrl, onChipClick, onIconClick } = _a, props = __rest(_a, ["className", "variant", "direction", "children", "iconPosition", "iconColor", "iconUrl", "onChipClick", "onIconClick"]);
|
|
42
42
|
const handleOnClick = () => {
|
|
43
43
|
onChipClick === null || onChipClick === void 0 ? void 0 : onChipClick();
|
|
44
44
|
};
|
|
45
45
|
const handleIconClick = () => {
|
|
46
46
|
onIconClick === null || onIconClick === void 0 ? void 0 : onIconClick();
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
const ChipIcon = ({ className }) => iconUrl ? (_jsx(Icon, { url: iconUrl, size: "xs", color: iconColor, className: className })) : (_jsx(Icon, { name: "square-x-filled", color: iconColor, className: className }));
|
|
49
|
+
return (_jsxs("div", Object.assign({ onClick: handleOnClick, ref: ref, className: cn(chipVariants({ variant, direction, iconPosition }), className) }, props, { children: [iconPosition === "left" && (_jsx("button", Object.assign({ onClick: handleIconClick, className: "h-full flex items-center justify-center pl-2" }, { children: _jsx(ChipIcon, { className: "mr-2 h-4 w-4 cursor-pointer" }) }))), children, iconPosition === "right" && (_jsx("button", Object.assign({ onClick: handleIconClick, className: "h-full flex items-center justify-center pr-2" }, { children: _jsx(ChipIcon, { className: "ml-2 h-4 w-4 cursor-pointer" }) })))] })));
|
|
49
50
|
});
|
|
50
51
|
Chip.displayName = "Chip";
|
|
51
52
|
const MultipleChips = ({ children, containerRef, }) => {
|
|
@@ -12,8 +12,9 @@ export interface IconProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "c
|
|
|
12
12
|
fillColor?: string | null;
|
|
13
13
|
secondaryFillColor?: string;
|
|
14
14
|
strokeColor?: string | null;
|
|
15
|
+
strokeWidth?: number | null;
|
|
15
16
|
fillPercentage?: number | null;
|
|
16
17
|
}
|
|
17
|
-
declare function Icon({ className, name, size, color, url, fillColor, secondaryFillColor, strokeColor, fillPercentage, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare function Icon({ className, name, size, color, url, fillColor, secondaryFillColor, strokeColor, strokeWidth, fillPercentage, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
export { Icon, iconVariants, IconPencilMinus };
|
|
19
20
|
//# sourceMappingURL=icon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../components/ui/icon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAEL,eAAe,EAuChB,MAAM,qBAAqB,CAAA;AAI5B,QAAA,MAAM,YAAY;;;mFAgBjB,CAAA;AA2DD,MAAM,WAAW,SACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,EACzD,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../components/ui/icon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAEL,eAAe,EAuChB,MAAM,qBAAqB,CAAA;AAI5B,QAAA,MAAM,YAAY;;;mFAgBjB,CAAA;AA2DD,MAAM,WAAW,SACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,EACzD,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AA0HD,iBAAS,IAAI,CAAC,EACZ,SAAS,EACT,IAAI,EACJ,IAAW,EACX,KAAK,EACL,GAAG,EACH,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,cAAc,EACd,GAAG,KAAK,EACT,EAAE,SAAS,2CAoBX;AAED,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -87,7 +87,7 @@ const TablerIcon = ({ name, size }) => {
|
|
|
87
87
|
const IconComponent = icons[name];
|
|
88
88
|
return IconComponent ? (_jsx(IconComponent, { size: sizeMapping[size], strokeWidth: strokeWidthMapping[size] })) : null;
|
|
89
89
|
};
|
|
90
|
-
const CustomIcon = ({ url, size, color, strokeColor, fillColor, fillPercentage, secondaryFillColor }) => {
|
|
90
|
+
const CustomIcon = ({ url, size, color, strokeColor, strokeWidth, fillColor, fillPercentage, secondaryFillColor, }) => {
|
|
91
91
|
return (_jsx(ReactSVG, { src: url, beforeInjection: (svg) => {
|
|
92
92
|
svg.setAttribute("style", `width: ${sizeMapping[size]}px; height: ${sizeMapping[size]}px`);
|
|
93
93
|
const paths = svg.querySelectorAll("path");
|
|
@@ -99,7 +99,9 @@ const CustomIcon = ({ url, size, color, strokeColor, fillColor, fillPercentage,
|
|
|
99
99
|
path.setAttribute("stroke", color);
|
|
100
100
|
}
|
|
101
101
|
else {
|
|
102
|
-
if (fillColor &&
|
|
102
|
+
if (fillColor &&
|
|
103
|
+
path.hasAttribute("fill") &&
|
|
104
|
+
fillPercentage === 1) {
|
|
103
105
|
path.setAttribute("fill", fillColor);
|
|
104
106
|
}
|
|
105
107
|
if (strokeColor) {
|
|
@@ -109,6 +111,9 @@ const CustomIcon = ({ url, size, color, strokeColor, fillColor, fillPercentage,
|
|
|
109
111
|
if (path.hasAttribute("stroke")) {
|
|
110
112
|
path.setAttribute("stroke-width", strokeWidthMapping[size].toString());
|
|
111
113
|
}
|
|
114
|
+
if (strokeWidth != null && path.hasAttribute("stroke")) {
|
|
115
|
+
path.setAttribute("stroke-width", strokeWidth.toString());
|
|
116
|
+
}
|
|
112
117
|
// Create a gradient fill based on the fillPercentage
|
|
113
118
|
if (fillPercentage && fillPercentage > 0 && fillPercentage < 1) {
|
|
114
119
|
const percentage = Math.min(Math.max(fillPercentage, 0), 1);
|
|
@@ -134,7 +139,7 @@ const CustomIcon = ({ url, size, color, strokeColor, fillColor, fillPercentage,
|
|
|
134
139
|
} }));
|
|
135
140
|
};
|
|
136
141
|
function Icon(_a) {
|
|
137
|
-
var { className, name, size = "md", color, url, fillColor, secondaryFillColor, strokeColor, fillPercentage } = _a, props = __rest(_a, ["className", "name", "size", "color", "url", "fillColor", "secondaryFillColor", "strokeColor", "fillPercentage"]);
|
|
138
|
-
return (_jsxs("div", Object.assign({ className: cn(iconVariants({ size, color }), className) }, props, { children: [url ? (_jsx(CustomIcon, { url: url, size: size, color: color, fillColor: fillColor, secondaryFillColor: secondaryFillColor, strokeColor: strokeColor, fillPercentage: fillPercentage || (color || fillColor ? 1 : 0) })) : (_jsx(TablerIcon, { name: name, size: size })), props.children] })));
|
|
142
|
+
var { className, name, size = "md", color, url, fillColor, secondaryFillColor, strokeColor, strokeWidth, fillPercentage } = _a, props = __rest(_a, ["className", "name", "size", "color", "url", "fillColor", "secondaryFillColor", "strokeColor", "strokeWidth", "fillPercentage"]);
|
|
143
|
+
return (_jsxs("div", Object.assign({ className: cn(iconVariants({ size, color }), className) }, props, { children: [url ? (_jsx(CustomIcon, { url: url, size: size, color: color, fillColor: fillColor, secondaryFillColor: secondaryFillColor, strokeColor: strokeColor, strokeWidth: strokeWidth, fillPercentage: fillPercentage || (color || fillColor ? 1 : 0) })) : (_jsx(TablerIcon, { name: name, size: size })), props.children] })));
|
|
139
144
|
}
|
|
140
145
|
export { Icon, iconVariants, IconPencilMinus };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
export interface QuantityPickerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
decreaseIconUrl: string;
|
|
4
|
+
increaseIconUrl: string;
|
|
5
|
+
deleteIconUrl: string;
|
|
6
|
+
isDeleteOnly: boolean;
|
|
7
|
+
iconColor: string;
|
|
6
8
|
onDecreaseClick: React.ReactEventHandler;
|
|
7
9
|
onIncreaseClick: React.ReactEventHandler;
|
|
8
10
|
value: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quantity-picker.d.ts","sourceRoot":"","sources":["../../../components/ui/quantity-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,WAAW,mBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5C,
|
|
1
|
+
{"version":3,"file":"quantity-picker.d.ts","sourceRoot":"","sources":["../../../components/ui/quantity-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,WAAW,mBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5C,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAiBD,QAAA,MAAM,cAAc,4FAwDnB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -10,14 +10,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import * as React from "react";
|
|
15
15
|
import { cn } from "../../lib/utils";
|
|
16
16
|
import { Icon } from "./icon";
|
|
17
|
-
const IconButton = ({
|
|
17
|
+
const IconButton = ({ iconUrl, iconColor, handler, className }) => (_jsx("button", Object.assign({ onClick: handler, className: cn("flex items-center justify-center h-7 w-7 bg-stateColors-skeleton outline outline-1 outline-stateColors-skeleton", className) }, { children: _jsx(Icon, { url: iconUrl, size: "sm", strokeColor: iconColor, strokeWidth: 4 }) })));
|
|
18
18
|
const QuantityPicker = React.forwardRef((_a, ref) => {
|
|
19
|
-
var { className,
|
|
20
|
-
return (
|
|
19
|
+
var { className, decreaseIconUrl, increaseIconUrl, deleteIconUrl, isDeleteOnly = false, iconColor, onDecreaseClick, onIncreaseClick, value, setValue } = _a, props = __rest(_a, ["className", "decreaseIconUrl", "increaseIconUrl", "deleteIconUrl", "isDeleteOnly", "iconColor", "onDecreaseClick", "onIncreaseClick", "value", "setValue"]);
|
|
20
|
+
return (_jsx("div", Object.assign({ className: cn("flex", className), ref: ref }, props, { children: isDeleteOnly ? (_jsx(IconButton, { handler: onDecreaseClick, iconUrl: deleteIconUrl, iconColor: iconColor, className: "rounded" })) : (_jsxs(_Fragment, { children: [_jsx(IconButton, { handler: onDecreaseClick, iconUrl: value === 1 ? deleteIconUrl : decreaseIconUrl, iconColor: iconColor, className: "rounded-tl rounded-bl" }), _jsx("div", Object.assign({ className: "w-8 h-7 py-1 flex justify-center bg-coreColors-inputBackground outline outline-1 outline-stateColors-skeleton text-[14px] font-sfpro-roboto leading-[160%] font-normal text-textColors-primaryColor" }, { children: _jsx("input", { type: "tel", pattern: "[0-9]*", value: value, onBlur: (e) => (e.target.value = value.toString()), onFocus: (e) => (e.target.value = ""), onChange: (e) => setValue(parseInt(e.target.value) || 0), className: "w-8 focus-visible:outline-none text-center bg-coreColors-inputBackground text-textColors-primaryColor" }) })), _jsx(IconButton, { handler: onIncreaseClick, iconUrl: increaseIconUrl, iconColor: iconColor, className: "rounded-tr rounded-br" })] })) })));
|
|
21
21
|
});
|
|
22
22
|
QuantityPicker.displayName = "QuantityPicker";
|
|
23
23
|
export { QuantityPicker };
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -202,4 +202,5 @@ export declare const createCollectionImageMap: (collections: {
|
|
|
202
202
|
image?: string;
|
|
203
203
|
}[]) => Record<string, string>;
|
|
204
204
|
export declare const isFavoriteIntegrationEnabled: (integrations: Integrations) => boolean;
|
|
205
|
+
export declare const pluralize: (word: string, count?: number, inclusive?: boolean) => string;
|
|
205
206
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils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,CAAA;KAAE,KAAK,IAAI,CAAA;CACxD,CAAA;AAmBD,eAAO,MAAM,qBAAqB,SAC1B,YAAY,GAAG,KAAK,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,iBAjBrC,MAAM,WAAW,kBAAkB,yBAE5C,MAAM,WAAW,kBAAkB,yBAO/B,MAAM,WAAW,kBAAkB,yBAEhC,MAAM,WAAW,kBAAkB,yBAS3D,CAAA;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,YAOlD;AAED,eAAO,MAAM,wBAAwB,gBACtB;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,2BAQpE,CAAA;AAED,eAAO,MAAM,4BAA4B,yCAIxC,CAAA;AAED,eAAO,MAAM,SAAS,SAAU,MAAM,UAAU,MAAM,cAAc,OAAO,WAE1E,CAAA"}
|
package/dist/lib/utils.js
CHANGED
|
@@ -2,6 +2,7 @@ import { clsx } from "clsx";
|
|
|
2
2
|
import { twMerge } from "tailwind-merge";
|
|
3
3
|
import dayjs from "dayjs";
|
|
4
4
|
import relativeTime from "dayjs/plugin/relativeTime";
|
|
5
|
+
import Pluralize from "pluralize";
|
|
5
6
|
export function cn(...inputs) {
|
|
6
7
|
return twMerge(clsx(inputs));
|
|
7
8
|
}
|
|
@@ -240,4 +241,7 @@ export const createCollectionImageMap = (collections) => {
|
|
|
240
241
|
export const isFavoriteIntegrationEnabled = (integrations) => {
|
|
241
242
|
return integrations.some(integration => (integration.name === "tapcart-wishlist" || integration.name === "swym") && integration.enabled);
|
|
242
243
|
};
|
|
244
|
+
export const pluralize = (word, count, inclusive) => {
|
|
245
|
+
return Pluralize(word, count, inclusive);
|
|
246
|
+
};
|
|
243
247
|
// #endregion =-=-=-= END BLOCK UTILS =-=-=-=
|
package/dist/styles.css
CHANGED
|
@@ -755,6 +755,9 @@ video {
|
|
|
755
755
|
.top-\[50\%\] {
|
|
756
756
|
top: 50%;
|
|
757
757
|
}
|
|
758
|
+
.z-0 {
|
|
759
|
+
z-index: 0;
|
|
760
|
+
}
|
|
758
761
|
.z-10 {
|
|
759
762
|
z-index: 10;
|
|
760
763
|
}
|
|
@@ -840,6 +843,9 @@ video {
|
|
|
840
843
|
.ml-2 {
|
|
841
844
|
margin-left: 0.5rem;
|
|
842
845
|
}
|
|
846
|
+
.ml-4 {
|
|
847
|
+
margin-left: 1rem;
|
|
848
|
+
}
|
|
843
849
|
.mr-2 {
|
|
844
850
|
margin-right: 0.5rem;
|
|
845
851
|
}
|
|
@@ -1017,6 +1023,9 @@ video {
|
|
|
1017
1023
|
.w-1\/2 {
|
|
1018
1024
|
width: 50%;
|
|
1019
1025
|
}
|
|
1026
|
+
.w-1\/3 {
|
|
1027
|
+
width: 33.333333%;
|
|
1028
|
+
}
|
|
1020
1029
|
.w-10 {
|
|
1021
1030
|
width: 2.5rem;
|
|
1022
1031
|
}
|
|
@@ -1035,6 +1044,9 @@ video {
|
|
|
1035
1044
|
.w-2\.5 {
|
|
1036
1045
|
width: 0.625rem;
|
|
1037
1046
|
}
|
|
1047
|
+
.w-2\/3 {
|
|
1048
|
+
width: 66.666667%;
|
|
1049
|
+
}
|
|
1038
1050
|
.w-4 {
|
|
1039
1051
|
width: 1rem;
|
|
1040
1052
|
}
|
|
@@ -1266,6 +1278,9 @@ video {
|
|
|
1266
1278
|
.items-center {
|
|
1267
1279
|
align-items: center;
|
|
1268
1280
|
}
|
|
1281
|
+
.items-stretch {
|
|
1282
|
+
align-items: stretch;
|
|
1283
|
+
}
|
|
1269
1284
|
.justify-start {
|
|
1270
1285
|
justify-content: flex-start;
|
|
1271
1286
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapcart/mobile-components",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.38",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"style": "dist/styles.css",
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"next": "^14.2.5",
|
|
78
78
|
"next-themes": "^0.2.1",
|
|
79
79
|
"postcss-cli": "^11.0.0",
|
|
80
|
+
"pluralize": "^8.0.0",
|
|
80
81
|
"react-intersection-observer": "^9.10.2",
|
|
81
82
|
"react-svg": "^16.1.34",
|
|
82
83
|
"swr": "^2.2.5",
|
|
@@ -84,4 +85,4 @@
|
|
|
84
85
|
"tailwindcss-animate": "^1.0.6",
|
|
85
86
|
"vaul": "0.9.1"
|
|
86
87
|
}
|
|
87
|
-
}
|
|
88
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../components/ThemeProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAE3D,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,2CAEvE"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
|
15
|
-
export function ThemeProvider(_a) {
|
|
16
|
-
var { children } = _a, props = __rest(_a, ["children"]);
|
|
17
|
-
return _jsx(NextThemesProvider, Object.assign({}, props, { children: children }));
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeToggle.d.ts","sourceRoot":"","sources":["../../components/ThemeToggle.tsx"],"names":[],"mappings":"AAOA,wBAAgB,WAAW,4CAc1B"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useTheme } from "next-themes";
|
|
4
|
-
import { Button } from "../components/ui/button";
|
|
5
|
-
export function ThemeToggle() {
|
|
6
|
-
const { setTheme, theme } = useTheme();
|
|
7
|
-
return (_jsxs(Button, Object.assign({ variant: "ghost", size: "sm", onClick: () => setTheme(theme === "light" ? "dark" : "light") }, { children: [_jsx("div", { className: "rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" }), _jsx("div", { className: "absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" }), _jsx("span", Object.assign({ className: "sr-only" }, { children: "Toggle theme" }))] })));
|
|
8
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { type VariantProps } from "class-variance-authority";
|
|
3
|
-
declare const inputVariants: (props?: ({
|
|
4
|
-
error?: boolean | null | undefined;
|
|
5
|
-
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
|
-
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange">, VariantProps<typeof inputVariants> {
|
|
7
|
-
id: string;
|
|
8
|
-
label?: string;
|
|
9
|
-
icon?: string;
|
|
10
|
-
asChild?: boolean;
|
|
11
|
-
value: string;
|
|
12
|
-
placeholder: string;
|
|
13
|
-
onChange: (_: string) => void;
|
|
14
|
-
}
|
|
15
|
-
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
16
|
-
export { Input };
|
|
17
|
-
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../components/ui/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,aAAa;;mFAalB,CAAA;AAED,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC,EACnE,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9B;AAED,QAAA,MAAM,KAAK,qFAkDV,CAAA;AAGD,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import * as React from "react";
|
|
14
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
15
|
-
import { cva } from "class-variance-authority";
|
|
16
|
-
import { cn } from "../../lib/utils";
|
|
17
|
-
import { Icon } from "./icon";
|
|
18
|
-
const inputVariants = cva("flex h-14 w-full rounded border border-coreColors-dividingLines bg-coreColors-inputBackground px-4 pt-5 pb-2 placeholder-shown:p-4 text-textColors-primaryColor text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-textColors-secondaryColor focus-visible:outline-none focus-visible:ring-0 disabled:cursor-not-allowed disabled:opacity-50 focus:border-coreColors-brandColorPrimary peer data-[icon=true]:pr-10", {
|
|
19
|
-
variants: {
|
|
20
|
-
error: {
|
|
21
|
-
true: "border-stateColors-error text-stateColors-error placeholder:text-stateColors-error focus:border-stateColors-error [&+label]:text-stateColors-error",
|
|
22
|
-
false: "",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
defaultVariants: {
|
|
26
|
-
error: false,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
const Input = React.forwardRef((_a, ref) => {
|
|
30
|
-
var { className, error = false, id, type, label, icon, asChild, value, placeholder, onChange } = _a, props = __rest(_a, ["className", "error", "id", "type", "label", "icon", "asChild", "value", "placeholder", "onChange"]);
|
|
31
|
-
const Comp = asChild ? Slot : "div";
|
|
32
|
-
return (_jsxs(Comp, Object.assign({ className: "relative group" }, { children: [_jsx("input", Object.assign({ placeholder: placeholder, value: value, onChange: (e) => onChange(e.target.value), id: id, type: type, className: cn(inputVariants({ error }), className), "data-icon": !!icon, ref: ref }, props)), label ? (_jsx("label", Object.assign({ htmlFor: id, className: "absolute text-[10px] text-textColors-secondaryColor group-active:text-coreColors-brandColorPrimary top-2 z-10 h-4 origin-[0] start-4 opacity-100 peer-placeholder-shown:opacity-0" }, { children: label }))) : null, icon ? (_jsx(Icon, { name: icon, "data-error": error, size: "sm", className: "absolute w-5 aspect-square fill-current text-textColors-secondaryColor top-[18px] z-10 origin-[0] end-4 peer-pr-8 icon data-[error=true]:text-stateColors-error" })) : null] })));
|
|
33
|
-
});
|
|
34
|
-
Input.displayName = "Input";
|
|
35
|
-
export { Input };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
type Product = any;
|
|
2
|
-
interface PageData {
|
|
3
|
-
products: Product[];
|
|
4
|
-
cursorBlob?: string;
|
|
5
|
-
filtersData: any;
|
|
6
|
-
}
|
|
7
|
-
interface ProductGridItemsProps {
|
|
8
|
-
initialData: PageData;
|
|
9
|
-
loadMoreProducts: (params: any) => Promise<PageData>;
|
|
10
|
-
queryVariables: Record<string, any>;
|
|
11
|
-
config: Record<string, any>;
|
|
12
|
-
}
|
|
13
|
-
declare function ProductGrid({ loadMoreProducts, initialData, queryVariables, config, }: ProductGridItemsProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export { ProductGrid };
|
|
15
|
-
//# sourceMappingURL=product-grid.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"product-grid.d.ts","sourceRoot":"","sources":["../../../components/ui/product-grid.tsx"],"names":[],"mappings":"AAkBA,KAAK,OAAO,GAAG,GAAG,CAAA;AAClB,UAAU,QAAQ;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,GAAG,CAAA;CACjB;AAED,UAAU,qBAAqB;IAC7B,WAAW,EAAE,QAAQ,CAAA;IACrB,gBAAgB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IACpD,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC5B;AAED,iBAAS,WAAW,CAAC,EACnB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,MAAM,GACP,EAAE,qBAAqB,2CAmCvB;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useInfiniteScroll } from "../hooks/use-infinite-scroll";
|
|
4
|
-
import { ProductCard } from "./product-card";
|
|
5
|
-
const Loader = () => (_jsx("div", Object.assign({ className: "grid-cols-2 lg:grid-cols-3" }, { children: Array(4)
|
|
6
|
-
.fill(0)
|
|
7
|
-
.map((_, index) => (_jsx("div", { className: "aspect-[2/3] animate-pulse bg-neutral-100 dark:bg-neutral-900" }, index))) })));
|
|
8
|
-
function ProductGrid({ loadMoreProducts, initialData, queryVariables, config, }) {
|
|
9
|
-
const { data, error, isLoadingInitialData, isLoadingMore, isEmpty, isReachingEnd, ref, products, } = useInfiniteScroll({
|
|
10
|
-
initialData,
|
|
11
|
-
loadMoreProducts,
|
|
12
|
-
queryVariables,
|
|
13
|
-
});
|
|
14
|
-
if (error)
|
|
15
|
-
return _jsx("div", { children: "Failed to load data" });
|
|
16
|
-
if (isLoadingInitialData)
|
|
17
|
-
return _jsx(Loader, {});
|
|
18
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({ className: "grid-cols-2 lg:grid-cols-3" }, { children: products.map((product, i) => (_jsx(ProductCard, {
|
|
19
|
-
// @ts-expect-error
|
|
20
|
-
product: product, config: config, isLoading: false }, product.handle))) })), isLoadingMore ? _jsx(Loader, {}) : _jsx("div", { ref: ref })] }));
|
|
21
|
-
}
|
|
22
|
-
export { ProductGrid };
|