@personizely/shopify-hydrogen 1.0.0 → 1.0.1
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.cjs +386 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +342 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +342 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +264 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +13 -4
- package/dist/classes/Adapter.d.ts +0 -33
- package/dist/classes/Adapter.d.ts.map +0 -1
- package/dist/classes/Adapter.js +0 -126
- package/dist/classes/Adapter.js.map +0 -1
- package/dist/classes/Cart.d.ts +0 -29
- package/dist/classes/Cart.d.ts.map +0 -1
- package/dist/classes/Cart.js +0 -272
- package/dist/classes/Cart.js.map +0 -1
- package/dist/components/PersonizelyProvider.d.ts +0 -36
- package/dist/components/PersonizelyProvider.d.ts.map +0 -1
- package/dist/components/PersonizelyProvider.js +0 -118
- package/dist/components/PersonizelyProvider.js.map +0 -1
- package/dist/graphql/queries/cart.d.ts +0 -7
- package/dist/graphql/queries/cart.d.ts.map +0 -1
- package/dist/graphql/queries/cart.js +0 -142
- package/dist/graphql/queries/cart.js.map +0 -1
- package/dist/graphql/queries/customer.d.ts +0 -5
- package/dist/graphql/queries/customer.d.ts.map +0 -1
- package/dist/graphql/queries/customer.js +0 -72
- package/dist/graphql/queries/customer.js.map +0 -1
- package/dist/graphql/queries/product.d.ts +0 -5
- package/dist/graphql/queries/product.d.ts.map +0 -1
- package/dist/graphql/queries/product.js +0 -114
- package/dist/graphql/queries/product.js.map +0 -1
- package/dist/hooks/useCartAdd.d.ts +0 -3
- package/dist/hooks/useCartAdd.d.ts.map +0 -1
- package/dist/hooks/useCartAdd.js +0 -18
- package/dist/hooks/useCartAdd.js.map +0 -1
- package/dist/hooks/useCheckout.d.ts +0 -2
- package/dist/hooks/useCheckout.d.ts.map +0 -1
- package/dist/hooks/useCheckout.js +0 -12
- package/dist/hooks/useCheckout.js.map +0 -1
- package/dist/hooks/usePageContext.d.ts +0 -3
- package/dist/hooks/usePageContext.d.ts.map +0 -1
- package/dist/hooks/usePageContext.js +0 -6
- package/dist/hooks/usePageContext.js.map +0 -1
- package/dist/hooks/usePersonizely.d.ts +0 -3
- package/dist/hooks/usePersonizely.d.ts.map +0 -1
- package/dist/hooks/usePersonizely.js +0 -11
- package/dist/hooks/usePersonizely.js.map +0 -1
- package/dist/index.d.ts +0 -10
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -8
- package/dist/index.js.map +0 -1
- package/dist/types/index.d.ts +0 -170
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -2
- package/dist/types/index.js.map +0 -1
- package/dist/types/interfaces.d.ts +0 -35
- package/dist/types/interfaces.d.ts.map +0 -1
- package/dist/types/interfaces.js +0 -2
- package/dist/types/interfaces.js.map +0 -1
- package/dist/utils/cookies.d.ts +0 -4
- package/dist/utils/cookies.d.ts.map +0 -1
- package/dist/utils/cookies.js +0 -33
- package/dist/utils/cookies.js.map +0 -1
- package/dist/utils/id.d.ts +0 -3
- package/dist/utils/id.d.ts.map +0 -1
- package/dist/utils/id.js +0 -7
- package/dist/utils/id.js.map +0 -1
- package/dist/utils/storefront-client.d.ts +0 -15
- package/dist/utils/storefront-client.d.ts.map +0 -1
- package/dist/utils/storefront-client.js +0 -39
- package/dist/utils/storefront-client.js.map +0 -1
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const CUSTOMER_FRAGMENT = "\n fragment CustomerFragment on Customer {\n id\n email\n phone\n firstName\n lastName\n displayName\n defaultAddress {\n id\n address1\n address2\n city\n province\n country\n zip\n }\n }\n";
|
|
2
|
-
export declare const ORDER_FRAGMENT = "\n fragment OrderFragment on Order {\n id\n orderNumber\n processedAt\n financialStatus\n fulfillmentStatus\n totalPrice {\n amount\n currencyCode\n }\n lineItems(first: 100) {\n nodes {\n title\n quantity\n variant {\n id\n title\n price {\n amount\n currencyCode\n }\n image {\n url\n altText\n }\n }\n }\n }\n }\n";
|
|
3
|
-
export declare const GET_CUSTOMER = "\n query getCustomer($customerAccessToken: String!) {\n customer(customerAccessToken: $customerAccessToken) {\n ...CustomerFragment\n }\n }\n \n fragment CustomerFragment on Customer {\n id\n email\n phone\n firstName\n lastName\n displayName\n defaultAddress {\n id\n address1\n address2\n city\n province\n country\n zip\n }\n }\n\n";
|
|
4
|
-
export declare const GET_CUSTOMER_ORDERS = "\n query getCustomerOrders($customerAccessToken: String!, $first: Int = 20) {\n customer(customerAccessToken: $customerAccessToken) {\n id\n orders(first: $first, sortKey: PROCESSED_AT, reverse: true) {\n nodes {\n ...OrderFragment\n }\n }\n }\n }\n \n fragment OrderFragment on Order {\n id\n orderNumber\n processedAt\n financialStatus\n fulfillmentStatus\n totalPrice {\n amount\n currencyCode\n }\n lineItems(first: 100) {\n nodes {\n title\n quantity\n variant {\n id\n title\n price {\n amount\n currencyCode\n }\n image {\n url\n altText\n }\n }\n }\n }\n }\n\n";
|
|
5
|
-
//# sourceMappingURL=customer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customer.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/customer.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,gQAkB7B,CAAA;AAED,eAAO,MAAM,cAAc,gfA8B1B,CAAA;AAED,eAAO,MAAM,YAAY,8ZAOxB,CAAA;AAED,eAAO,MAAM,mBAAmB,2xBAY/B,CAAA"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
export const CUSTOMER_FRAGMENT = `
|
|
2
|
-
fragment CustomerFragment on Customer {
|
|
3
|
-
id
|
|
4
|
-
email
|
|
5
|
-
phone
|
|
6
|
-
firstName
|
|
7
|
-
lastName
|
|
8
|
-
displayName
|
|
9
|
-
defaultAddress {
|
|
10
|
-
id
|
|
11
|
-
address1
|
|
12
|
-
address2
|
|
13
|
-
city
|
|
14
|
-
province
|
|
15
|
-
country
|
|
16
|
-
zip
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
export const ORDER_FRAGMENT = `
|
|
21
|
-
fragment OrderFragment on Order {
|
|
22
|
-
id
|
|
23
|
-
orderNumber
|
|
24
|
-
processedAt
|
|
25
|
-
financialStatus
|
|
26
|
-
fulfillmentStatus
|
|
27
|
-
totalPrice {
|
|
28
|
-
amount
|
|
29
|
-
currencyCode
|
|
30
|
-
}
|
|
31
|
-
lineItems(first: 100) {
|
|
32
|
-
nodes {
|
|
33
|
-
title
|
|
34
|
-
quantity
|
|
35
|
-
variant {
|
|
36
|
-
id
|
|
37
|
-
title
|
|
38
|
-
price {
|
|
39
|
-
amount
|
|
40
|
-
currencyCode
|
|
41
|
-
}
|
|
42
|
-
image {
|
|
43
|
-
url
|
|
44
|
-
altText
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
`;
|
|
51
|
-
export const GET_CUSTOMER = `
|
|
52
|
-
query getCustomer($customerAccessToken: String!) {
|
|
53
|
-
customer(customerAccessToken: $customerAccessToken) {
|
|
54
|
-
...CustomerFragment
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
${CUSTOMER_FRAGMENT}
|
|
58
|
-
`;
|
|
59
|
-
export const GET_CUSTOMER_ORDERS = `
|
|
60
|
-
query getCustomerOrders($customerAccessToken: String!, $first: Int = 20) {
|
|
61
|
-
customer(customerAccessToken: $customerAccessToken) {
|
|
62
|
-
id
|
|
63
|
-
orders(first: $first, sortKey: PROCESSED_AT, reverse: true) {
|
|
64
|
-
nodes {
|
|
65
|
-
...OrderFragment
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
${ORDER_FRAGMENT}
|
|
71
|
-
`;
|
|
72
|
-
//# sourceMappingURL=customer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customer.js","sourceRoot":"","sources":["../../../src/graphql/queries/customer.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;CAkBhC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B7B,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;IAMxB,iBAAiB;CACpB,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;IAW/B,cAAc;CACjB,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const PRODUCT_FRAGMENT = "\n fragment ProductFragment on Product {\n id\n handle\n title\n description\n descriptionHtml\n productType\n vendor\n tags\n availableForSale\n requiresSellingPlan\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n maxVariantPrice {\n amount\n currencyCode\n }\n }\n featuredImage {\n id\n url\n altText\n width\n height\n }\n images(first: 10) {\n nodes {\n id\n url\n altText\n width\n height\n }\n }\n variants(first: 100) {\n nodes {\n id\n title\n availableForSale\n quantityAvailable\n sellingPlanAllocations(first: 10) {\n edges {\n node {\n sellingPlan {\n id\n }\n }\n }\n }\n sku\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n selectedOptions {\n name\n value\n }\n image {\n id\n url\n altText\n width\n height\n }\n }\n }\n options {\n id\n name\n values\n }\n collections(first: 10) {\n nodes {\n id\n handle\n title\n }\n }\n }\n";
|
|
2
|
-
export declare const GET_PRODUCT_BY_HANDLE = "\n query getProductByHandle($handle: String!) {\n product(handle: $handle) {\n ...ProductFragment\n }\n }\n \n fragment ProductFragment on Product {\n id\n handle\n title\n description\n descriptionHtml\n productType\n vendor\n tags\n availableForSale\n requiresSellingPlan\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n maxVariantPrice {\n amount\n currencyCode\n }\n }\n featuredImage {\n id\n url\n altText\n width\n height\n }\n images(first: 10) {\n nodes {\n id\n url\n altText\n width\n height\n }\n }\n variants(first: 100) {\n nodes {\n id\n title\n availableForSale\n quantityAvailable\n sellingPlanAllocations(first: 10) {\n edges {\n node {\n sellingPlan {\n id\n }\n }\n }\n }\n sku\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n selectedOptions {\n name\n value\n }\n image {\n id\n url\n altText\n width\n height\n }\n }\n }\n options {\n id\n name\n values\n }\n collections(first: 10) {\n nodes {\n id\n handle\n title\n }\n }\n }\n\n";
|
|
3
|
-
export declare const GET_PRODUCT_BY_ID = "\n query getProductById($id: ID!) {\n product(id: $id) {\n ...ProductFragment\n }\n }\n \n fragment ProductFragment on Product {\n id\n handle\n title\n description\n descriptionHtml\n productType\n vendor\n tags\n availableForSale\n requiresSellingPlan\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n maxVariantPrice {\n amount\n currencyCode\n }\n }\n featuredImage {\n id\n url\n altText\n width\n height\n }\n images(first: 10) {\n nodes {\n id\n url\n altText\n width\n height\n }\n }\n variants(first: 100) {\n nodes {\n id\n title\n availableForSale\n quantityAvailable\n sellingPlanAllocations(first: 10) {\n edges {\n node {\n sellingPlan {\n id\n }\n }\n }\n }\n sku\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n selectedOptions {\n name\n value\n }\n image {\n id\n url\n altText\n width\n height\n }\n }\n }\n options {\n id\n name\n values\n }\n collections(first: 10) {\n nodes {\n id\n handle\n title\n }\n }\n }\n\n";
|
|
4
|
-
export declare const GET_PRODUCT_RECOMMENDATIONS = "\n query getProductRecommendations($productId: ID!) {\n productRecommendations(productId: $productId) {\n ...ProductFragment\n }\n }\n \n fragment ProductFragment on Product {\n id\n handle\n title\n description\n descriptionHtml\n productType\n vendor\n tags\n availableForSale\n requiresSellingPlan\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n maxVariantPrice {\n amount\n currencyCode\n }\n }\n featuredImage {\n id\n url\n altText\n width\n height\n }\n images(first: 10) {\n nodes {\n id\n url\n altText\n width\n height\n }\n }\n variants(first: 100) {\n nodes {\n id\n title\n availableForSale\n quantityAvailable\n sellingPlanAllocations(first: 10) {\n edges {\n node {\n sellingPlan {\n id\n }\n }\n }\n }\n sku\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n selectedOptions {\n name\n value\n }\n image {\n id\n url\n altText\n width\n height\n }\n }\n }\n options {\n id\n name\n values\n }\n collections(first: 10) {\n nodes {\n id\n handle\n title\n }\n }\n }\n\n";
|
|
5
|
-
//# sourceMappingURL=product.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/product.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,u5CAwF5B,CAAA;AAED,eAAO,MAAM,qBAAqB,mhDAOjC,CAAA;AAED,eAAO,MAAM,iBAAiB,+/CAO7B,CAAA;AAED,eAAO,MAAM,2BAA2B,8iDAOvC,CAAA"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
export const PRODUCT_FRAGMENT = `
|
|
2
|
-
fragment ProductFragment on Product {
|
|
3
|
-
id
|
|
4
|
-
handle
|
|
5
|
-
title
|
|
6
|
-
description
|
|
7
|
-
descriptionHtml
|
|
8
|
-
productType
|
|
9
|
-
vendor
|
|
10
|
-
tags
|
|
11
|
-
availableForSale
|
|
12
|
-
requiresSellingPlan
|
|
13
|
-
priceRange {
|
|
14
|
-
minVariantPrice {
|
|
15
|
-
amount
|
|
16
|
-
currencyCode
|
|
17
|
-
}
|
|
18
|
-
maxVariantPrice {
|
|
19
|
-
amount
|
|
20
|
-
currencyCode
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
featuredImage {
|
|
24
|
-
id
|
|
25
|
-
url
|
|
26
|
-
altText
|
|
27
|
-
width
|
|
28
|
-
height
|
|
29
|
-
}
|
|
30
|
-
images(first: 10) {
|
|
31
|
-
nodes {
|
|
32
|
-
id
|
|
33
|
-
url
|
|
34
|
-
altText
|
|
35
|
-
width
|
|
36
|
-
height
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
variants(first: 100) {
|
|
40
|
-
nodes {
|
|
41
|
-
id
|
|
42
|
-
title
|
|
43
|
-
availableForSale
|
|
44
|
-
quantityAvailable
|
|
45
|
-
sellingPlanAllocations(first: 10) {
|
|
46
|
-
edges {
|
|
47
|
-
node {
|
|
48
|
-
sellingPlan {
|
|
49
|
-
id
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
sku
|
|
55
|
-
price {
|
|
56
|
-
amount
|
|
57
|
-
currencyCode
|
|
58
|
-
}
|
|
59
|
-
compareAtPrice {
|
|
60
|
-
amount
|
|
61
|
-
currencyCode
|
|
62
|
-
}
|
|
63
|
-
selectedOptions {
|
|
64
|
-
name
|
|
65
|
-
value
|
|
66
|
-
}
|
|
67
|
-
image {
|
|
68
|
-
id
|
|
69
|
-
url
|
|
70
|
-
altText
|
|
71
|
-
width
|
|
72
|
-
height
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
options {
|
|
77
|
-
id
|
|
78
|
-
name
|
|
79
|
-
values
|
|
80
|
-
}
|
|
81
|
-
collections(first: 10) {
|
|
82
|
-
nodes {
|
|
83
|
-
id
|
|
84
|
-
handle
|
|
85
|
-
title
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
`;
|
|
90
|
-
export const GET_PRODUCT_BY_HANDLE = `
|
|
91
|
-
query getProductByHandle($handle: String!) {
|
|
92
|
-
product(handle: $handle) {
|
|
93
|
-
...ProductFragment
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
${PRODUCT_FRAGMENT}
|
|
97
|
-
`;
|
|
98
|
-
export const GET_PRODUCT_BY_ID = `
|
|
99
|
-
query getProductById($id: ID!) {
|
|
100
|
-
product(id: $id) {
|
|
101
|
-
...ProductFragment
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
${PRODUCT_FRAGMENT}
|
|
105
|
-
`;
|
|
106
|
-
export const GET_PRODUCT_RECOMMENDATIONS = `
|
|
107
|
-
query getProductRecommendations($productId: ID!) {
|
|
108
|
-
productRecommendations(productId: $productId) {
|
|
109
|
-
...ProductFragment
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
${PRODUCT_FRAGMENT}
|
|
113
|
-
`;
|
|
114
|
-
//# sourceMappingURL=product.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"product.js","sourceRoot":"","sources":["../../../src/graphql/queries/product.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwF/B,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;IAMjC,gBAAgB;CACnB,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;IAM7B,gBAAgB;CACnB,CAAA;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;IAMvC,gBAAgB;CACnB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCartAdd.d.ts","sourceRoot":"","sources":["../../src/hooks/useCartAdd.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAoC9C,wBAAgB,UAAU,cAGW,cAAc,KAAG,OAAO,CAAC,OAAO,CAAC,CAYrE"}
|
package/dist/hooks/useCartAdd.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
import { usePersonizely } from './usePersonizely';
|
|
3
|
-
import { toId } from '../utils/id';
|
|
4
|
-
export function useCartAdd() {
|
|
5
|
-
const personizely = usePersonizely();
|
|
6
|
-
return useCallback(async (product) => {
|
|
7
|
-
if (typeof window === 'undefined') {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
return await personizely.triggerCartAdd({
|
|
11
|
-
...product,
|
|
12
|
-
id: toId(String(product.id)),
|
|
13
|
-
variantId: toId(String(product.variantId)),
|
|
14
|
-
price: Number(product.price) * 100
|
|
15
|
-
});
|
|
16
|
-
}, [personizely]);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=useCartAdd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCartAdd.js","sourceRoot":"","sources":["../../src/hooks/useCartAdd.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAkClC,MAAM,UAAU,UAAU;IACxB,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IAEpC,OAAO,WAAW,CAAC,KAAK,EAAE,OAAuB,EAAoB,EAAE;QACrE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,OAAO,KAAK,CAAA;QACd,CAAC;QAED,OAAO,MAAM,WAAW,CAAC,cAAc,CAAC;YACtC,GAAG,OAAO;YACV,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAC5B,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAC1C,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG;SACnC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;AACnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCheckout.d.ts","sourceRoot":"","sources":["../../src/hooks/useCheckout.ts"],"names":[],"mappings":"AA8BA,wBAAgB,WAAW,UAGI,OAAO,CAAC,OAAO,CAAC,CAO9C"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
import { usePersonizely } from './usePersonizely';
|
|
3
|
-
export function useCheckout() {
|
|
4
|
-
const personizely = usePersonizely();
|
|
5
|
-
return useCallback(async () => {
|
|
6
|
-
if (typeof window === 'undefined') {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
return await personizely.triggerCheckout();
|
|
10
|
-
}, [personizely]);
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=useCheckout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCheckout.js","sourceRoot":"","sources":["../../src/hooks/useCheckout.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAyBjD,MAAM,UAAU,WAAW;IACzB,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IAEpC,OAAO,WAAW,CAAC,KAAK,IAAsB,EAAE;QAC9C,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,OAAO,KAAK,CAAA;QACd,CAAC;QAED,OAAO,MAAM,WAAW,CAAC,eAAe,EAAE,CAAA;IAC5C,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;AACnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePageContext.d.ts","sourceRoot":"","sources":["../../src/hooks/usePageContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEtC,wBAAgB,cAAc,CAAE,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,QAI5D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePageContext.js","sourceRoot":"","sources":["../../src/hooks/usePageContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGjD,MAAM,UAAU,cAAc,CAAE,OAA6B;IAC3D,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IAEpC,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;AAC7C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePersonizely.d.ts","sourceRoot":"","sources":["../../src/hooks/usePersonizely.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsB,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAiB9F,wBAAgB,cAAc,IAAK,sBAAsB,CASxD"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { PersonizelyContext } from '../components/PersonizelyProvider';
|
|
3
|
-
export function usePersonizely() {
|
|
4
|
-
const context = useContext(PersonizelyContext);
|
|
5
|
-
if (!context) {
|
|
6
|
-
throw new Error('usePersonizely must be used within a PersonizelyProvider. ' +
|
|
7
|
-
'Make sure your component is wrapped with <PersonizelyProvider>.');
|
|
8
|
-
}
|
|
9
|
-
return context;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=usePersonizely.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePersonizely.js","sourceRoot":"","sources":["../../src/hooks/usePersonizely.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,kBAAkB,EAA0B,MAAM,mCAAmC,CAAA;AAiB9F,MAAM,UAAU,cAAc;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAA;IAE9C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,4DAA4D;YAC1E,iEAAiE,CAAC,CAAA;IACtE,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { PersonizelyProvider } from './components/PersonizelyProvider';
|
|
2
|
-
export type { PersonizelyProviderProps, PersonizelyContextType } from './components/PersonizelyProvider';
|
|
3
|
-
export { usePersonizely } from './hooks/usePersonizely';
|
|
4
|
-
export { useCartAdd } from './hooks/useCartAdd';
|
|
5
|
-
export { useCheckout } from './hooks/useCheckout';
|
|
6
|
-
export { usePageContext } from './hooks/usePageContext';
|
|
7
|
-
export { Cart } from './classes/Cart';
|
|
8
|
-
export { Adapter } from './classes/Adapter';
|
|
9
|
-
export type { PersonizelyConfig, HydrogenConfig, CartAddProduct, ICart, IShopifyAdapter, PageContext } from './types';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AACtE,YAAY,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AAGxG,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAGvD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAG3C,YAAY,EAEV,iBAAiB,EACjB,cAAc,EACd,cAAc,EAGd,KAAK,EACL,eAAe,EAGf,WAAW,EACZ,MAAM,SAAS,CAAA"}
|
package/dist/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { PersonizelyProvider } from './components/PersonizelyProvider';
|
|
2
|
-
export { usePersonizely } from './hooks/usePersonizely';
|
|
3
|
-
export { useCartAdd } from './hooks/useCartAdd';
|
|
4
|
-
export { useCheckout } from './hooks/useCheckout';
|
|
5
|
-
export { usePageContext } from './hooks/usePageContext';
|
|
6
|
-
export { Cart } from './classes/Cart';
|
|
7
|
-
export { Adapter } from './classes/Adapter';
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAItE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAGvD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import type { ICart, IShopifyAdapter } from './interfaces';
|
|
2
|
-
export type ProductData = {
|
|
3
|
-
id: number;
|
|
4
|
-
handle: string;
|
|
5
|
-
title: string;
|
|
6
|
-
available: boolean;
|
|
7
|
-
requires_selling_plan: boolean;
|
|
8
|
-
images: string[];
|
|
9
|
-
variants: ProductDataVariant[];
|
|
10
|
-
};
|
|
11
|
-
export type ProductDataVariant = {
|
|
12
|
-
id: number;
|
|
13
|
-
title: string;
|
|
14
|
-
available: boolean;
|
|
15
|
-
price: number;
|
|
16
|
-
compare_at_price: number | null;
|
|
17
|
-
featured_image: {
|
|
18
|
-
src: string;
|
|
19
|
-
} | null;
|
|
20
|
-
selling_plan_allocations: Array<{
|
|
21
|
-
selling_plan_id: string;
|
|
22
|
-
}>;
|
|
23
|
-
};
|
|
24
|
-
export type Product = {
|
|
25
|
-
id: string;
|
|
26
|
-
handle: string;
|
|
27
|
-
title: string;
|
|
28
|
-
description: string;
|
|
29
|
-
descriptionHtml: string;
|
|
30
|
-
variants: {
|
|
31
|
-
nodes: Variant[];
|
|
32
|
-
};
|
|
33
|
-
images: {
|
|
34
|
-
nodes: Image[];
|
|
35
|
-
};
|
|
36
|
-
featuredImage?: Image | null;
|
|
37
|
-
priceRange: PriceRange;
|
|
38
|
-
tags: string[];
|
|
39
|
-
productType: string;
|
|
40
|
-
vendor: string;
|
|
41
|
-
collections: {
|
|
42
|
-
nodes: Collection[];
|
|
43
|
-
};
|
|
44
|
-
requiresSellingPlan: boolean;
|
|
45
|
-
availableForSale: boolean;
|
|
46
|
-
options: ProductOption[];
|
|
47
|
-
};
|
|
48
|
-
export type Variant = {
|
|
49
|
-
id: string;
|
|
50
|
-
title: string;
|
|
51
|
-
price: Money;
|
|
52
|
-
compareAtPrice?: Money | null;
|
|
53
|
-
availableForSale: boolean;
|
|
54
|
-
sellingPlanAllocations: {
|
|
55
|
-
edges: Array<{
|
|
56
|
-
node: {
|
|
57
|
-
sellingPlan: {
|
|
58
|
-
id: string;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
}>;
|
|
62
|
-
};
|
|
63
|
-
selectedOptions: SelectedOption[];
|
|
64
|
-
image?: Image | null;
|
|
65
|
-
sku?: string | null;
|
|
66
|
-
quantityAvailable?: number;
|
|
67
|
-
};
|
|
68
|
-
export type Image = {
|
|
69
|
-
id?: string;
|
|
70
|
-
url: string;
|
|
71
|
-
altText?: string | null;
|
|
72
|
-
width?: number;
|
|
73
|
-
height?: number;
|
|
74
|
-
};
|
|
75
|
-
export type Money = {
|
|
76
|
-
amount: string;
|
|
77
|
-
currencyCode: string;
|
|
78
|
-
};
|
|
79
|
-
export type PriceRange = {
|
|
80
|
-
minVariantPrice: Money;
|
|
81
|
-
maxVariantPrice: Money;
|
|
82
|
-
};
|
|
83
|
-
export type ProductOption = {
|
|
84
|
-
id?: string;
|
|
85
|
-
name: string;
|
|
86
|
-
values: string[];
|
|
87
|
-
};
|
|
88
|
-
export type SelectedOption = {
|
|
89
|
-
name: string;
|
|
90
|
-
value: string;
|
|
91
|
-
};
|
|
92
|
-
export type Collection = {
|
|
93
|
-
id: string;
|
|
94
|
-
handle: string;
|
|
95
|
-
title: string;
|
|
96
|
-
description?: string;
|
|
97
|
-
};
|
|
98
|
-
export type CartData = {
|
|
99
|
-
token: string;
|
|
100
|
-
item_count: number;
|
|
101
|
-
items: CartDataItem[];
|
|
102
|
-
total_price: number;
|
|
103
|
-
discount_codes?: DiscountCode[];
|
|
104
|
-
attributes?: Record<string, any>;
|
|
105
|
-
note?: string | null;
|
|
106
|
-
};
|
|
107
|
-
export type CartDataItem = {
|
|
108
|
-
id: number;
|
|
109
|
-
quantity: number;
|
|
110
|
-
product_id: number;
|
|
111
|
-
variant_id: number;
|
|
112
|
-
price: number;
|
|
113
|
-
};
|
|
114
|
-
export type DiscountCode = {
|
|
115
|
-
code: string;
|
|
116
|
-
applicable: boolean;
|
|
117
|
-
};
|
|
118
|
-
export type Customer = {
|
|
119
|
-
id: string;
|
|
120
|
-
email?: string | null;
|
|
121
|
-
phone?: string | null;
|
|
122
|
-
firstName?: string | null;
|
|
123
|
-
lastName?: string | null;
|
|
124
|
-
displayName: string;
|
|
125
|
-
hasAccount: boolean;
|
|
126
|
-
tags: string[];
|
|
127
|
-
};
|
|
128
|
-
export type PageContext = {
|
|
129
|
-
pageType?: string | number;
|
|
130
|
-
product?: {
|
|
131
|
-
handle: string;
|
|
132
|
-
id: number;
|
|
133
|
-
tags?: string[];
|
|
134
|
-
} | null;
|
|
135
|
-
collection?: {
|
|
136
|
-
id: number;
|
|
137
|
-
} | null;
|
|
138
|
-
};
|
|
139
|
-
export type CartAddProduct = {
|
|
140
|
-
id: string | number;
|
|
141
|
-
variantId: string | number;
|
|
142
|
-
price?: string | number;
|
|
143
|
-
quantity?: number;
|
|
144
|
-
handle?: string;
|
|
145
|
-
properties?: Record<string, string>;
|
|
146
|
-
};
|
|
147
|
-
export type PersonizelyConfigMethods = {
|
|
148
|
-
formatMoney: (amount: number, includeDecimals: boolean) => string;
|
|
149
|
-
builtProductPath?: ({ handle }: {
|
|
150
|
-
handle: string;
|
|
151
|
-
}) => string;
|
|
152
|
-
};
|
|
153
|
-
export type PersonizelyConfig = {
|
|
154
|
-
locale?: string;
|
|
155
|
-
currency?: {
|
|
156
|
-
rate?: number;
|
|
157
|
-
active?: string;
|
|
158
|
-
base?: string;
|
|
159
|
-
};
|
|
160
|
-
market?: string;
|
|
161
|
-
methods?: PersonizelyConfigMethods;
|
|
162
|
-
};
|
|
163
|
-
export type HydrogenConfig = {
|
|
164
|
-
cart: ICart;
|
|
165
|
-
adapter: IShopifyAdapter;
|
|
166
|
-
onCartAdd: (callback: (product: CartAddProduct) => Promise<boolean>) => () => void;
|
|
167
|
-
onCheckout: (callback: () => Promise<boolean>) => () => void;
|
|
168
|
-
};
|
|
169
|
-
export type { ICart, IShopifyAdapter } from './interfaces';
|
|
170
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAK1D,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,OAAO,CAAA;IAClB,qBAAqB,EAAE,OAAO,CAAA;IAC9B,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,QAAQ,EAAE,kBAAk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AAE,eAAe,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/types/index.js
DELETED
package/dist/types/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { CartData, Customer, ProductData, PageContext } from './index';
|
|
2
|
-
export interface ICart {
|
|
3
|
-
isSynced(): boolean;
|
|
4
|
-
onChange(callback: (cart: CartData) => void): () => void;
|
|
5
|
-
fetch(force?: boolean): Promise<CartData | null>;
|
|
6
|
-
update(action: string, data: any): Promise<void>;
|
|
7
|
-
buy(variantId: string, quantity?: number): void;
|
|
8
|
-
get(property?: string): any;
|
|
9
|
-
getToken(): string | null;
|
|
10
|
-
getItemsIds(): string[];
|
|
11
|
-
getValue(currency?: string): number;
|
|
12
|
-
getSize(distinct?: boolean): number;
|
|
13
|
-
fetchCollections(force?: boolean): Promise<any>;
|
|
14
|
-
applyCoupon(code: string, expiresIn?: number): Promise<void>;
|
|
15
|
-
getCoupon(): string | null;
|
|
16
|
-
}
|
|
17
|
-
export interface IShopifyAdapter {
|
|
18
|
-
fetchProduct(handle: string): Promise<ProductData>;
|
|
19
|
-
fetchProductCollections(handle: string, productId: number): Promise<any>;
|
|
20
|
-
fetchRecommendations(productId: number, intent: string): Promise<{
|
|
21
|
-
products: ProductData[];
|
|
22
|
-
intent: string;
|
|
23
|
-
}>;
|
|
24
|
-
buildProductPath(params: {
|
|
25
|
-
handle: string;
|
|
26
|
-
}): string;
|
|
27
|
-
convertToBaseCurrency(amount: number): number;
|
|
28
|
-
convertFromBaseCurrency(amount: number): number;
|
|
29
|
-
formatMoney(amount: number, includeDecimals: boolean): string;
|
|
30
|
-
getCustomer(): Promise<Customer | null>;
|
|
31
|
-
getPageContext(): PageContext;
|
|
32
|
-
getVisitorId(): string | null;
|
|
33
|
-
getMarket(): string | null;
|
|
34
|
-
}
|
|
35
|
-
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AAO,CAAC,WAAW,CAAC,CAAA;IAKlD,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;IAOxE,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAK7G,gBAAgB,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAA;IAKpD,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IAK7C,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IAK/C,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,GAAG,MAAM,CAAA;IAK7D,WAAW,IAAI,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;IAKvC,cAAc,IAAI,WAAW,CAAA;IAM7B,YAAY,IAAI,MAAM,GAAG,IAAI,CAAA;IAK7B,SAAS,IAAI,MAAM,GAAG,IAAI,CAAA;CAC3B"}
|
package/dist/types/interfaces.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/types/interfaces.ts"],"names":[],"mappings":""}
|
package/dist/utils/cookies.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function readCookie(name: string): string | null;
|
|
2
|
-
export declare function createCookie(name: string, value: string, days?: number, path?: string): void;
|
|
3
|
-
export declare function deleteCookie(name: string, path?: string): void;
|
|
4
|
-
//# sourceMappingURL=cookies.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../src/utils/cookies.ts"],"names":[],"mappings":"AAUA,wBAAgB,UAAU,CAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmBvD;AASD,wBAAgB,YAAY,CAAE,IAAI,EAAE,MAAM,EACxC,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM,EACb,IAAI,GAAE,MAAY,GAAG,IAAI,CAa1B;AAOD,wBAAgB,YAAY,CAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAY,GAAG,IAAI,CAEpE"}
|
package/dist/utils/cookies.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export function readCookie(name) {
|
|
2
|
-
if (typeof document === 'undefined') {
|
|
3
|
-
return null;
|
|
4
|
-
}
|
|
5
|
-
const nameEQ = name + '=';
|
|
6
|
-
const cookies = document.cookie.split(';');
|
|
7
|
-
for (let i = 0; i < cookies.length; i++) {
|
|
8
|
-
let cookie = cookies[i];
|
|
9
|
-
while (cookie.charAt(0) === ' ') {
|
|
10
|
-
cookie = cookie.substring(1, cookie.length);
|
|
11
|
-
}
|
|
12
|
-
if (cookie.indexOf(nameEQ) === 0) {
|
|
13
|
-
return cookie.substring(nameEQ.length, cookie.length);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
export function createCookie(name, value, days, path = '/') {
|
|
19
|
-
if (typeof document === 'undefined') {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
let expires = '';
|
|
23
|
-
if (days) {
|
|
24
|
-
const date = new Date();
|
|
25
|
-
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
26
|
-
expires = '; expires=' + date.toUTCString();
|
|
27
|
-
}
|
|
28
|
-
document.cookie = name + '=' + value + expires + '; path=' + path;
|
|
29
|
-
}
|
|
30
|
-
export function deleteCookie(name, path = '/') {
|
|
31
|
-
createCookie(name, '', -1, path);
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=cookies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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