@decocms/apps-wake 8.1.0-next.0 → 8.1.0-next.2

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.
Files changed (94) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +4 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/storefront.d.ts +14 -0
  6. package/dist/storefront.d.ts.map +1 -0
  7. package/dist/storefront.js +14 -0
  8. package/dist/storefront.js.map +1 -0
  9. package/dist/storefrontTypes.d.ts +7 -0
  10. package/dist/storefrontTypes.d.ts.map +1 -0
  11. package/dist/storefrontTypes.js +2 -0
  12. package/dist/storefrontTypes.js.map +1 -0
  13. package/dist/utils/client.d.ts +12 -0
  14. package/dist/utils/client.d.ts.map +1 -0
  15. package/dist/utils/client.js +2 -0
  16. package/dist/utils/client.js.map +1 -0
  17. package/dist/utils/gql.d.ts +16 -0
  18. package/dist/utils/gql.d.ts.map +1 -0
  19. package/dist/utils/gql.js +16 -0
  20. package/dist/utils/gql.js.map +1 -0
  21. package/dist/utils/graphql/queries.d.ts +117 -0
  22. package/dist/utils/graphql/queries.d.ts.map +1 -0
  23. package/dist/utils/graphql/queries.js +1323 -0
  24. package/dist/utils/graphql/queries.js.map +1 -0
  25. package/dist/utils/graphql/storefront.graphql.gen.d.ts +10344 -0
  26. package/dist/utils/graphql/storefront.graphql.gen.d.ts.map +1 -0
  27. package/dist/utils/graphql/storefront.graphql.gen.js +9 -0
  28. package/dist/utils/graphql/storefront.graphql.gen.js.map +1 -0
  29. package/dist/utils/graphqlOperationName.d.ts +36 -0
  30. package/dist/utils/graphqlOperationName.d.ts.map +1 -0
  31. package/dist/utils/graphqlOperationName.js +59 -0
  32. package/dist/utils/graphqlOperationName.js.map +1 -0
  33. package/dist/wakeClient.d.ts +54 -0
  34. package/dist/wakeClient.d.ts.map +1 -0
  35. package/dist/wakeClient.js +85 -0
  36. package/dist/wakeClient.js.map +1 -0
  37. package/package.json +26 -37
  38. package/src/index.ts +3 -63
  39. package/src/storefront.ts +1 -1
  40. package/src/storefrontTypes.ts +1 -1
  41. package/src/utils/gql.ts +1 -2
  42. package/src/utils/graphql/queries.ts +1 -1
  43. package/src/wakeClient.ts +3 -3
  44. package/src/__tests__/wakeClient.test.ts +0 -136
  45. package/src/actions/cart/addCoupon.ts +0 -43
  46. package/src/actions/cart/addItem.ts +0 -10
  47. package/src/actions/cart/addItems.ts +0 -50
  48. package/src/actions/cart/addKit.ts +0 -53
  49. package/src/actions/cart/partnerAssociate.ts +0 -48
  50. package/src/actions/cart/partnerDisassociate.ts +0 -43
  51. package/src/actions/cart/removeCoupon.ts +0 -39
  52. package/src/actions/cart/removeKit.ts +0 -56
  53. package/src/actions/cart/updateItemQuantity.ts +0 -69
  54. package/src/actions/newsletter/register.ts +0 -32
  55. package/src/actions/notifyme.ts +0 -28
  56. package/src/actions/review/create.ts +0 -30
  57. package/src/actions/shippingSimulation.ts +0 -60
  58. package/src/actions/submmitForm.ts +0 -25
  59. package/src/actions/wishlist/addProduct.ts +0 -43
  60. package/src/actions/wishlist/removeProduct.ts +0 -45
  61. package/src/client.ts +0 -123
  62. package/src/commerceLoaders.ts +0 -137
  63. package/src/handlers/sitemap.ts +0 -61
  64. package/src/loaders/cart.ts +0 -46
  65. package/src/loaders/partners.ts +0 -58
  66. package/src/loaders/productDetailsPage.ts +0 -174
  67. package/src/loaders/productList.ts +0 -262
  68. package/src/loaders/productListingPage.ts +0 -333
  69. package/src/loaders/proxy.ts +0 -79
  70. package/src/loaders/recommendations.ts +0 -84
  71. package/src/loaders/shop.ts +0 -37
  72. package/src/loaders/suggestion.ts +0 -67
  73. package/src/loaders/user.ts +0 -48
  74. package/src/loaders/wishlist.ts +0 -40
  75. package/src/manifest.gen.ts +0 -69
  76. package/src/mod.ts +0 -88
  77. package/src/registry.ts +0 -9
  78. package/src/utils/authError.ts +0 -107
  79. package/src/utils/authenticate.ts +0 -42
  80. package/src/utils/capitalize.ts +0 -9
  81. package/src/utils/cart.ts +0 -33
  82. package/src/utils/cookies.ts +0 -82
  83. package/src/utils/getVariations.ts +0 -47
  84. package/src/utils/graphql.ts +0 -72
  85. package/src/utils/httpError.ts +0 -15
  86. package/src/utils/instrumentedFetch.ts +0 -46
  87. package/src/utils/operationRouter.ts +0 -51
  88. package/src/utils/parseHeaders.ts +0 -19
  89. package/src/utils/partner.ts +0 -34
  90. package/src/utils/requestCtx.ts +0 -41
  91. package/src/utils/transform.ts +0 -460
  92. package/src/utils/types.ts +0 -6
  93. package/src/utils/user.ts +0 -9
  94. package/tsconfig.json +0 -7
@@ -0,0 +1,3 @@
1
+ export type { UserAuthenticate } from "./utils/client.ts";
2
+ export { createWakeClient, type WakeClient, type WakeClientConfig, type WakeClientOptions, WakeError, } from "./wakeClient.ts";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACL,gBAAgB,EAChB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,SAAS,GACV,MAAM,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ // The thin Wake client (see /next/upstream-clients). Operations are in
2
+ // `@decocms/apps-wake/storefront`, their types in `.../storefront/types`.
3
+ export { createWakeClient, WakeError, } from "./wakeClient.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,0EAA0E;AAG1E,OAAO,EACL,gBAAgB,EAIhB,SAAS,GACV,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `@decocms/apps-wake/storefront`: Wake's Storefront GraphQL operations, to
3
+ * pass to `createWakeClient`'s `graphql`. Their generated request and response
4
+ * types are in `@decocms/apps-wake/storefront/types`:
5
+ *
6
+ * ```ts
7
+ * import { GetProduct } from "@decocms/apps-wake/storefront";
8
+ * import type { GetProductQuery, GetProductQueryVariables } from "@decocms/apps-wake/storefront/types";
9
+ *
10
+ * const data = await wake.graphql<GetProductQuery, GetProductQueryVariables>(GetProduct, { productId: 1 });
11
+ * ```
12
+ */
13
+ export * from "./utils/graphql/queries.ts";
14
+ //# sourceMappingURL=storefront.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storefront.d.ts","sourceRoot":"","sources":["../src/storefront.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `@decocms/apps-wake/storefront`: Wake's Storefront GraphQL operations, to
3
+ * pass to `createWakeClient`'s `graphql`. Their generated request and response
4
+ * types are in `@decocms/apps-wake/storefront/types`:
5
+ *
6
+ * ```ts
7
+ * import { GetProduct } from "@decocms/apps-wake/storefront";
8
+ * import type { GetProductQuery, GetProductQueryVariables } from "@decocms/apps-wake/storefront/types";
9
+ *
10
+ * const data = await wake.graphql<GetProductQuery, GetProductQueryVariables>(GetProduct, { productId: 1 });
11
+ * ```
12
+ */
13
+ export * from "./utils/graphql/queries.js";
14
+ //# sourceMappingURL=storefront.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storefront.js","sourceRoot":"","sources":["../src/storefront.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `@decocms/apps-wake/storefront/types`: types generated from Wake's
3
+ * Storefront GraphQL schema, one `<Operation>Query`/`<Operation>Mutation` and
4
+ * `...Variables` pair per operation in `@decocms/apps-wake/storefront`.
5
+ */
6
+ export type * from "./utils/graphql/storefront.graphql.gen.ts";
7
+ //# sourceMappingURL=storefrontTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storefrontTypes.d.ts","sourceRoot":"","sources":["../src/storefrontTypes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,mBAAmB,2CAA2C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=storefrontTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storefrontTypes.js","sourceRoot":"","sources":["../src/storefrontTypes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ /** Response shape of the Wake checkout REST endpoint `GET /api/Login/Get`. */
2
+ export interface UserAuthenticate {
3
+ Cpf: string;
4
+ CustomerAccessToken: string;
5
+ Email: string;
6
+ HasFirstPurchase: boolean;
7
+ Id: string;
8
+ Name: string;
9
+ PhoneNumber: string;
10
+ Type: number;
11
+ }
12
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/utils/client.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,mBAAmB,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,OAAO,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/utils/client.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * GraphQL document helpers used by the client (`../wakeClient.ts`). Pure: no I/O, no framework imports.
3
+ */
4
+ /**
5
+ * Tagged-template helper that composes a GraphQL document string.
6
+ * Kept identical to the Deno `gql` so `graphql/queries.ts` (which defines
7
+ * `{ fragments, query }` objects) works verbatim.
8
+ */
9
+ export declare function gql(strings: TemplateStringsArray, ...values: unknown[]): string;
10
+ /** A Wake storefront operation: its document plus the fragments it spreads. */
11
+ export interface QueryDefinition {
12
+ fragments?: string[];
13
+ query: string;
14
+ }
15
+ export declare function buildQuery(def: QueryDefinition): string;
16
+ //# sourceMappingURL=gql.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gql.d.ts","sourceRoot":"","sources":["../../src/utils/gql.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAE/E;AAED,+EAA+E;AAC/E,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAGvD"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * GraphQL document helpers used by the client (`../wakeClient.ts`). Pure: no I/O, no framework imports.
3
+ */
4
+ /**
5
+ * Tagged-template helper that composes a GraphQL document string.
6
+ * Kept identical to the Deno `gql` so `graphql/queries.ts` (which defines
7
+ * `{ fragments, query }` objects) works verbatim.
8
+ */
9
+ export function gql(strings, ...values) {
10
+ return strings.reduce((acc, str, i) => acc + str + (values[i] ?? ""), "");
11
+ }
12
+ export function buildQuery(def) {
13
+ const fragments = def.fragments?.join("\n") ?? "";
14
+ return fragments ? `${fragments}\n${def.query}` : def.query;
15
+ }
16
+ //# sourceMappingURL=gql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gql.js","sourceRoot":"","sources":["../../src/utils/gql.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,OAA6B,EAAE,GAAG,MAAiB;IACrE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAC5E,CAAC;AAQD,MAAM,UAAU,UAAU,CAAC,GAAoB;IAC7C,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAClD,OAAO,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,KAAK,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,117 @@
1
+ export declare const Customer: string;
2
+ export declare const WishlistReducedProduct: string;
3
+ export declare const GetProduct: {
4
+ fragments: string[];
5
+ query: string;
6
+ };
7
+ export declare const GetCart: {
8
+ fragments: string[];
9
+ query: string;
10
+ };
11
+ export declare const CreateCart: {
12
+ fragments: string[];
13
+ query: string;
14
+ };
15
+ export declare const GetProducts: {
16
+ fragments: string[];
17
+ query: string;
18
+ };
19
+ export declare const Search: {
20
+ fragments: string[];
21
+ query: string;
22
+ };
23
+ export declare const AddCoupon: {
24
+ fragments: string[];
25
+ query: string;
26
+ };
27
+ export declare const AddItemToCart: {
28
+ fragments: string[];
29
+ query: string;
30
+ };
31
+ export declare const RemoveCoupon: {
32
+ fragments: string[];
33
+ query: string;
34
+ };
35
+ export declare const RemoveItemFromCart: {
36
+ fragments: string[];
37
+ query: string;
38
+ };
39
+ export declare const ProductRestockAlert: {
40
+ fragments: string[];
41
+ query: string;
42
+ };
43
+ export declare const WishlistAddProduct: {
44
+ fragments: string[];
45
+ query: string;
46
+ };
47
+ export declare const WishlistRemoveProduct: {
48
+ fragments: string[];
49
+ query: string;
50
+ };
51
+ export declare const CreateNewsletterRegister: {
52
+ fragments: string[];
53
+ query: string;
54
+ };
55
+ export declare const Autocomplete: {
56
+ fragments: string[];
57
+ query: string;
58
+ };
59
+ export declare const ProductRecommendations: {
60
+ fragments: string[];
61
+ query: string;
62
+ };
63
+ export declare const ShippingQuotes: {
64
+ fragments: string[];
65
+ query: string;
66
+ };
67
+ export declare const GetUser: {
68
+ fragments: string[];
69
+ query: string;
70
+ };
71
+ export declare const GetWishlist: {
72
+ fragments: string[];
73
+ query: string;
74
+ };
75
+ export declare const GetURL: {
76
+ query: string;
77
+ };
78
+ export declare const CreateProductReview: {
79
+ query: string;
80
+ };
81
+ export declare const SendGenericForm: {
82
+ query: string;
83
+ };
84
+ export declare const Hotsite: {
85
+ fragments: string[];
86
+ query: string;
87
+ };
88
+ export declare const productOptions: {
89
+ query: string;
90
+ };
91
+ export declare const Shop: {
92
+ query: string;
93
+ };
94
+ export declare const GetBuyList: {
95
+ fragments: string[];
96
+ query: string;
97
+ };
98
+ export declare const AddKit: {
99
+ fragments: string[];
100
+ query: string;
101
+ };
102
+ export declare const RemoveKit: {
103
+ fragments: string[];
104
+ query: string;
105
+ };
106
+ export declare const GetPartners: {
107
+ query: string;
108
+ };
109
+ export declare const CheckoutPartnerAssociate: {
110
+ fragments: string[];
111
+ query: string;
112
+ };
113
+ export declare const CheckoutPartnerDisassociate: {
114
+ fragments: string[];
115
+ query: string;
116
+ };
117
+ //# sourceMappingURL=queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/utils/graphql/queries.ts"],"names":[],"mappings":"AA65BA,eAAO,MAAM,QAAQ,QAepB,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAKlC,CAAC;AAEF,eAAO,MAAM,UAAU;IACrB,SAAS;IACT,KAAK;CAKN,CAAC;AAEF,eAAO,MAAM,OAAO;IAClB,SAAS;IACT,KAAK;CAGN,CAAC;AAEF,eAAO,MAAM,UAAU;IACrB,SAAS;IACT,KAAK;CACN,CAAC;AAEF,eAAO,MAAM,WAAW;IACt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