@faststore/api 3.29.1 → 3.30.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/cjs/package.json +1 -1
- package/dist/cjs/src/__generated__/schema.d.ts +39 -0
- package/dist/cjs/src/__generated__/schema.js.map +1 -1
- package/dist/cjs/src/index.d.ts +3 -0
- package/dist/cjs/src/platforms/vtex/clients/commerce/index.d.ts +10 -7
- package/dist/cjs/src/platforms/vtex/clients/commerce/index.js +13 -0
- package/dist/cjs/src/platforms/vtex/clients/commerce/index.js.map +1 -1
- package/dist/cjs/src/platforms/vtex/clients/commerce/types/Profile.d.ts +18 -0
- package/dist/cjs/src/platforms/vtex/clients/commerce/types/Profile.js +3 -0
- package/dist/cjs/src/platforms/vtex/clients/commerce/types/Profile.js.map +1 -0
- package/dist/cjs/src/platforms/vtex/clients/index.d.ts +3 -0
- package/dist/cjs/src/platforms/vtex/clients/index.js.map +1 -1
- package/dist/cjs/src/platforms/vtex/index.d.ts +3 -0
- package/dist/cjs/src/platforms/vtex/resolvers/query.d.ts +6 -2
- package/dist/cjs/src/platforms/vtex/resolvers/query.js +25 -13
- package/dist/cjs/src/platforms/vtex/resolvers/query.js.map +1 -1
- package/dist/cjs/src/typeDefs/profile.graphql +61 -0
- package/dist/cjs/src/typeDefs/query.graphql +11 -0
- package/dist/esm/package.json +1 -1
- package/dist/esm/src/__generated__/schema.d.ts +39 -0
- package/dist/esm/src/__generated__/schema.js.map +1 -1
- package/dist/esm/src/index.d.ts +3 -0
- package/dist/esm/src/platforms/vtex/clients/commerce/index.d.ts +10 -7
- package/dist/esm/src/platforms/vtex/clients/commerce/index.js +13 -0
- package/dist/esm/src/platforms/vtex/clients/commerce/index.js.map +1 -1
- package/dist/esm/src/platforms/vtex/clients/commerce/types/Profile.d.ts +18 -0
- package/dist/esm/src/platforms/vtex/clients/commerce/types/Profile.js +2 -0
- package/dist/esm/src/platforms/vtex/clients/commerce/types/Profile.js.map +1 -0
- package/dist/esm/src/platforms/vtex/clients/index.d.ts +3 -0
- package/dist/esm/src/platforms/vtex/clients/index.js.map +1 -1
- package/dist/esm/src/platforms/vtex/index.d.ts +3 -0
- package/dist/esm/src/platforms/vtex/resolvers/query.d.ts +6 -2
- package/dist/esm/src/platforms/vtex/resolvers/query.js +14 -2
- package/dist/esm/src/platforms/vtex/resolvers/query.js.map +1 -1
- package/dist/esm/src/typeDefs/profile.graphql +61 -0
- package/dist/esm/src/typeDefs/query.graphql +11 -0
- package/package.json +2 -2
- package/src/__generated__/schema.ts +43 -0
- package/src/platforms/vtex/clients/commerce/index.ts +29 -9
- package/src/platforms/vtex/clients/commerce/types/Profile.ts +19 -0
- package/src/platforms/vtex/clients/index.ts +1 -1
- package/src/platforms/vtex/resolvers/query.ts +40 -17
- package/src/typeDefs/profile.graphql +61 -0
- package/src/typeDefs/query.graphql +11 -0
package/dist/cjs/package.json
CHANGED
|
@@ -436,6 +436,40 @@ export type PickupStoreInfo = {
|
|
|
436
436
|
/** Information if the store has pickup enable. */
|
|
437
437
|
isPickupStore?: Maybe<Scalars['Boolean']>;
|
|
438
438
|
};
|
|
439
|
+
export type Profile = {
|
|
440
|
+
__typename?: 'Profile';
|
|
441
|
+
/** Collection of user's address */
|
|
442
|
+
addresses?: Maybe<Array<Maybe<ProfileAddress>>>;
|
|
443
|
+
};
|
|
444
|
+
export type ProfileAddress = {
|
|
445
|
+
__typename?: 'ProfileAddress';
|
|
446
|
+
/** ProfileAddress address name/id. */
|
|
447
|
+
addressName?: Maybe<Scalars['String']>;
|
|
448
|
+
/** ProfileAddress address type. */
|
|
449
|
+
addressType?: Maybe<Scalars['String']>;
|
|
450
|
+
/** ProfileAddress city. */
|
|
451
|
+
city?: Maybe<Scalars['String']>;
|
|
452
|
+
/** ProfileAddress complement. */
|
|
453
|
+
complement?: Maybe<Scalars['String']>;
|
|
454
|
+
/** ProfileAddress country. */
|
|
455
|
+
country?: Maybe<Scalars['String']>;
|
|
456
|
+
/** ProfileAddress geo coordinate. */
|
|
457
|
+
geoCoordinate?: Maybe<Array<Maybe<Scalars['Float']>>>;
|
|
458
|
+
/** ProfileAddress neighborhood. */
|
|
459
|
+
neighborhood?: Maybe<Scalars['String']>;
|
|
460
|
+
/** ProfileAddress number. */
|
|
461
|
+
number?: Maybe<Scalars['String']>;
|
|
462
|
+
/** ProfileAddress postal code. */
|
|
463
|
+
postalCode?: Maybe<Scalars['String']>;
|
|
464
|
+
/** ProfileAddress receiver name. */
|
|
465
|
+
receiverName?: Maybe<Scalars['String']>;
|
|
466
|
+
/** ProfileAddress reference. */
|
|
467
|
+
reference?: Maybe<Scalars['String']>;
|
|
468
|
+
/** ProfileAddress state. */
|
|
469
|
+
state?: Maybe<Scalars['String']>;
|
|
470
|
+
/** ProfileAddress street. */
|
|
471
|
+
street?: Maybe<Scalars['String']>;
|
|
472
|
+
};
|
|
439
473
|
export type Query = {
|
|
440
474
|
__typename?: 'Query';
|
|
441
475
|
/** Returns information about all collections. */
|
|
@@ -446,6 +480,8 @@ export type Query = {
|
|
|
446
480
|
collection: StoreCollection;
|
|
447
481
|
/** Returns the details of a product based on the specified locator. */
|
|
448
482
|
product: StoreProduct;
|
|
483
|
+
/** Returns information about the profile. */
|
|
484
|
+
profile?: Maybe<Profile>;
|
|
449
485
|
/** Returns if there's a redirect for a search. */
|
|
450
486
|
redirect?: Maybe<StoreRedirect>;
|
|
451
487
|
/** Returns the result of a product, facet, or suggestion search. */
|
|
@@ -469,6 +505,9 @@ export type QueryCollectionArgs = {
|
|
|
469
505
|
export type QueryProductArgs = {
|
|
470
506
|
locator: Array<IStoreSelectedFacet>;
|
|
471
507
|
};
|
|
508
|
+
export type QueryProfileArgs = {
|
|
509
|
+
id: Scalars['String'];
|
|
510
|
+
};
|
|
472
511
|
export type QueryRedirectArgs = {
|
|
473
512
|
selectedFacets?: Maybe<Array<IStoreSelectedFacet>>;
|
|
474
513
|
term?: Maybe<Scalars['String']>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/__generated__/schema.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/__generated__/schema.ts"],"names":[],"mappings":";;AAq0BC,CAAC;AA+DD,CAAC;AAgVD,CAAC;AAOD,CAAC"}
|
package/dist/cjs/src/index.d.ts
CHANGED
|
@@ -97,6 +97,9 @@ export declare const getResolvers: (options: Options) => {
|
|
|
97
97
|
id: string;
|
|
98
98
|
sellers: import("./platforms/vtex/clients/commerce/types/Region").Seller[];
|
|
99
99
|
}>;
|
|
100
|
+
profile: (_: unknown, { id }: import("./__generated__/schema").QueryProfileArgs, ctx: import("./platforms/vtex").Context) => Promise<{
|
|
101
|
+
addresses: import("./platforms/vtex/clients/commerce/types/Profile").ProfileAddress[];
|
|
102
|
+
}>;
|
|
100
103
|
};
|
|
101
104
|
Mutation: {
|
|
102
105
|
validateCart: (_: unknown, { cart: { order }, session }: import("./__generated__/schema").MutationValidateCartArgs, ctx: import("./platforms/vtex").Context) => Promise<{
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { FACET_CROSS_SELLING_MAP } from '../../utils/facets';
|
|
2
|
-
import type {
|
|
2
|
+
import type { StoreMarketingData } from '../../../..';
|
|
3
3
|
import type { Context, Options } from '../../index';
|
|
4
|
+
import type { Channel } from '../../utils/channel';
|
|
5
|
+
import type { Address, AddressInput } from './types/Address';
|
|
4
6
|
import type { Brand } from './types/Brand';
|
|
5
7
|
import type { CategoryTree } from './types/CategoryTree';
|
|
8
|
+
import type { MasterDataResponse } from './types/Newsletter';
|
|
6
9
|
import type { OrderForm, OrderFormInputItem } from './types/OrderForm';
|
|
7
10
|
import type { PortalPagetype } from './types/Portal';
|
|
11
|
+
import type { PortalProduct } from './types/Product';
|
|
8
12
|
import type { Region, RegionInput } from './types/Region';
|
|
9
|
-
import type { Simulation, SimulationArgs, SimulationOptions } from './types/Simulation';
|
|
10
|
-
import type { Session } from './types/Session';
|
|
11
|
-
import type { Channel } from '../../utils/channel';
|
|
12
13
|
import type { SalesChannel } from './types/SalesChannel';
|
|
13
|
-
import type {
|
|
14
|
-
import type { Address, AddressInput } from './types/Address';
|
|
14
|
+
import type { Session } from './types/Session';
|
|
15
15
|
import type { DeliveryMode, SelectedAddress } from './types/ShippingData';
|
|
16
|
-
import type {
|
|
16
|
+
import type { Simulation, SimulationArgs, SimulationOptions } from './types/Simulation';
|
|
17
17
|
type ValueOf<T> = T extends Record<string, infer K> ? K : never;
|
|
18
18
|
export declare const VtexCommerce: ({ account, environment, incrementAddress, subDomainPrefix }: Options, ctx: Context) => {
|
|
19
19
|
catalog: {
|
|
@@ -76,5 +76,8 @@ export declare const VtexCommerce: ({ account, environment, incrementAddress, su
|
|
|
76
76
|
name: string;
|
|
77
77
|
email: string;
|
|
78
78
|
}) => Promise<MasterDataResponse>;
|
|
79
|
+
profile: {
|
|
80
|
+
addresses: (userId: string) => Promise<Record<string, string>>;
|
|
81
|
+
};
|
|
79
82
|
};
|
|
80
83
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VtexCommerce = void 0;
|
|
4
|
+
const cookie_1 = require("cookie");
|
|
4
5
|
const fetch_1 = require("../fetch");
|
|
5
6
|
const cookies_1 = require("../../utils/cookies");
|
|
6
7
|
const BASE_INIT = {
|
|
@@ -198,6 +199,18 @@ const VtexCommerce = ({ account, environment, incrementAddress, subDomainPrefix
|
|
|
198
199
|
method: 'PATCH',
|
|
199
200
|
}, { storeCookies });
|
|
200
201
|
},
|
|
202
|
+
profile: {
|
|
203
|
+
addresses: async (userId) => {
|
|
204
|
+
const headers = withCookie({
|
|
205
|
+
'content-type': 'application/json',
|
|
206
|
+
'X-FORWARDED-HOST': forwardedHost,
|
|
207
|
+
});
|
|
208
|
+
const cookies = (0, cookie_1.parse)(ctx?.headers?.cookie ?? '');
|
|
209
|
+
const VtexIdclientAutCookie = cookies['VtexIdclientAutCookie_' + account];
|
|
210
|
+
headers['VtexIdclientAutCookie'] = VtexIdclientAutCookie;
|
|
211
|
+
return (0, fetch_1.fetchAPI)(`${base}/api/profile-system/pvt/profiles/${userId}/addresses`, { headers }, { storeCookies });
|
|
212
|
+
},
|
|
213
|
+
},
|
|
201
214
|
};
|
|
202
215
|
};
|
|
203
216
|
exports.VtexCommerce = VtexCommerce;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/platforms/vtex/clients/commerce/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/platforms/vtex/clients/commerce/index.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAE9B,oCAAmC;AAKnC,iDAAmE;AAoBnE,MAAM,SAAS,GAAG;IAChB,MAAM,EAAE,MAAM;IACd,OAAO,EAAE;QACP,cAAc,EAAE,kBAAkB;KACnC;CACF,CAAA;AAEM,MAAM,YAAY,GAAG,CAC1B,EAAE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAW,EACpE,GAAY,EACZ,EAAE;IACF,MAAM,IAAI,GAAG,WAAW,OAAO,IAAI,WAAW,SAAS,CAAA;IACvD,MAAM,YAAY,GAAG,IAAA,wBAAc,EAAC,GAAG,CAAC,CAAA;IACxC,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,GAAG,CAAC,CAAA;IAErC,MAAM,IAAI,GACR,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAA;IAE7E,MAAM,cAAc,GAAG,eAAe;QACpC,CAAC,CAAC,eAAe;aACZ,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC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AAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,CAAA;gBAC7C,OAAO,CAAC,uBAAuB,CAAC,GAAG,qBAAqB,CAAA;gBAExD,OAAO,IAAA,gBAAQ,EACb,GAAG,IAAI,oCAAoC,MAAM,YAAY,EAC7D,EAAE,OAAO,EAAE,EACX,EAAE,YAAY,EAAE,CACjB,CAAA;YACH,CAAC;SACF;KACF,CAAA;AACH,CAAC,CAAA;AAxXY,QAAA,YAAY,gBAwXxB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface Profile {
|
|
2
|
+
addresses: ProfileAddress[];
|
|
3
|
+
}
|
|
4
|
+
export interface ProfileAddress {
|
|
5
|
+
addressName: string;
|
|
6
|
+
addressType: string;
|
|
7
|
+
postalCode: string;
|
|
8
|
+
city: string;
|
|
9
|
+
state: string;
|
|
10
|
+
country: string;
|
|
11
|
+
street: string;
|
|
12
|
+
number: string;
|
|
13
|
+
neighborhood: string;
|
|
14
|
+
complement: string;
|
|
15
|
+
reference: string;
|
|
16
|
+
receiverName: string;
|
|
17
|
+
geoCoordinate: [number, number];
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Profile.js","sourceRoot":"","sources":["../../../../../../../../src/platforms/vtex/clients/commerce/types/Profile.ts"],"names":[],"mappings":""}
|
|
@@ -68,5 +68,8 @@ export declare const getClients: (options: Options, ctx: Context) => {
|
|
|
68
68
|
name: string;
|
|
69
69
|
email: string;
|
|
70
70
|
}) => Promise<import("./commerce/types/Newsletter").MasterDataResponse>;
|
|
71
|
+
profile: {
|
|
72
|
+
addresses: (userId: string) => Promise<Record<string, string>>;
|
|
73
|
+
};
|
|
71
74
|
};
|
|
72
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/platforms/vtex/clients/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/platforms/vtex/clients/index.ts"],"names":[],"mappings":";;;AACA,yCAAyC;AACzC,qCAA4C;AAIrC,MAAM,UAAU,GAAG,CAAC,OAAgB,EAAE,GAAY,EAAE,EAAE;IAC3D,MAAM,MAAM,GAAG,IAAA,0BAAiB,EAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IAC9C,MAAM,QAAQ,GAAG,IAAA,uBAAY,EAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IAE3C,OAAO;QACL,MAAM;QACN,QAAQ;KACT,CAAA;AACH,CAAC,CAAA;AARY,QAAA,UAAU,cAQtB"}
|
|
@@ -129,6 +129,9 @@ export declare const getResolvers: (_: Options) => {
|
|
|
129
129
|
id: string;
|
|
130
130
|
sellers: import("./clients/commerce/types/Region").Seller[];
|
|
131
131
|
}>;
|
|
132
|
+
profile: (_: unknown, { id }: import("../..").QueryProfileArgs, ctx: Context) => Promise<{
|
|
133
|
+
addresses: import("./clients/commerce/types/Profile").ProfileAddress[];
|
|
134
|
+
}>;
|
|
132
135
|
};
|
|
133
136
|
Mutation: {
|
|
134
137
|
validateCart: (_: unknown, { cart: { order }, session }: import("../..").MutationValidateCartArgs, ctx: Context) => Promise<{
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { QueryAllCollectionsArgs, QueryAllProductsArgs, QueryCollectionArgs, QueryProductArgs, QuerySearchArgs, QuerySellersArgs, QueryShippingArgs
|
|
1
|
+
import type { QueryAllCollectionsArgs, QueryAllProductsArgs, QueryCollectionArgs, QueryProductArgs, QueryProfileArgs, QueryRedirectArgs, QuerySearchArgs, QuerySellersArgs, QueryShippingArgs } from '../../../__generated__/schema';
|
|
2
2
|
import type { CategoryTree } from '../clients/commerce/types/CategoryTree';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ProfileAddress } from '../clients/commerce/types/Profile';
|
|
4
4
|
import type { SearchArgs } from '../clients/search';
|
|
5
|
+
import type { Context } from '../index';
|
|
5
6
|
export declare const Query: {
|
|
6
7
|
product: (_: unknown, { locator }: QueryProductArgs, ctx: Context) => Promise<import("../utils/enhanceSku").EnhancedSku>;
|
|
7
8
|
collection: (_: unknown, { slug }: QueryCollectionArgs, ctx: Context) => Promise<import("../clients/commerce/types/Portal").CollectionPageType>;
|
|
@@ -69,4 +70,7 @@ export declare const Query: {
|
|
|
69
70
|
id: string;
|
|
70
71
|
sellers: import("../clients/commerce/types/Region").Seller[];
|
|
71
72
|
}>;
|
|
73
|
+
profile: (_: unknown, { id }: QueryProfileArgs, ctx: Context) => Promise<{
|
|
74
|
+
addresses: ProfileAddress[];
|
|
75
|
+
}>;
|
|
72
76
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Query = void 0;
|
|
4
|
-
const facets_1 = require("./../utils/facets");
|
|
5
4
|
const errors_1 = require("../../errors");
|
|
6
5
|
const contex_1 = require("../utils/contex");
|
|
7
6
|
const enhanceSku_1 = require("../utils/enhanceSku");
|
|
8
|
-
const
|
|
7
|
+
const facets_1 = require("../utils/facets");
|
|
8
|
+
const sku_1 = require("../utils/sku");
|
|
9
9
|
const sort_1 = require("../utils/sort");
|
|
10
|
+
const facets_2 = require("./../utils/facets");
|
|
10
11
|
const collection_1 = require("./collection");
|
|
11
|
-
const sku_1 = require("../utils/sku");
|
|
12
12
|
exports.Query = {
|
|
13
13
|
product: async (_, { locator }, ctx) => {
|
|
14
14
|
// Insert channel in context for later usage
|
|
15
|
-
const channel = (0,
|
|
16
|
-
const locale = (0,
|
|
17
|
-
const id = (0,
|
|
18
|
-
const slug = (0,
|
|
15
|
+
const channel = (0, facets_1.findChannel)(locator);
|
|
16
|
+
const locale = (0, facets_1.findLocale)(locator);
|
|
17
|
+
const id = (0, facets_1.findSkuId)(locator);
|
|
18
|
+
const slug = (0, facets_1.findSlug)(locator);
|
|
19
19
|
if (channel) {
|
|
20
20
|
(0, contex_1.mutateChannelContext)(ctx, channel);
|
|
21
21
|
}
|
|
@@ -69,9 +69,9 @@ exports.Query = {
|
|
|
69
69
|
},
|
|
70
70
|
search: async (_, { first, after: maybeAfter, sort, term, selectedFacets, sponsoredCount, }, ctx) => {
|
|
71
71
|
// Insert channel in context for later usage
|
|
72
|
-
const channel = (0,
|
|
73
|
-
const locale = (0,
|
|
74
|
-
const crossSelling = (0,
|
|
72
|
+
const channel = (0, facets_1.findChannel)(selectedFacets);
|
|
73
|
+
const locale = (0, facets_1.findLocale)(selectedFacets);
|
|
74
|
+
const crossSelling = (0, facets_1.findCrossSelling)(selectedFacets);
|
|
75
75
|
if (channel) {
|
|
76
76
|
(0, contex_1.mutateChannelContext)(ctx, channel);
|
|
77
77
|
}
|
|
@@ -90,7 +90,7 @@ exports.Query = {
|
|
|
90
90
|
*/
|
|
91
91
|
if (crossSelling) {
|
|
92
92
|
const products = await ctx.clients.commerce.catalog.products.crossselling({
|
|
93
|
-
type:
|
|
93
|
+
type: facets_2.FACET_CROSS_SELLING_MAP[crossSelling.key],
|
|
94
94
|
productId: crossSelling.value,
|
|
95
95
|
});
|
|
96
96
|
query = `product:${products
|
|
@@ -104,7 +104,7 @@ exports.Query = {
|
|
|
104
104
|
count: first,
|
|
105
105
|
query: query ?? undefined,
|
|
106
106
|
sort: sort_1.SORT_MAP[sort ?? 'score_desc'],
|
|
107
|
-
selectedFacets: selectedFacets?.flatMap(
|
|
107
|
+
selectedFacets: selectedFacets?.flatMap(facets_1.transformSelectedFacet) ?? [],
|
|
108
108
|
sponsoredCount: sponsoredCount ?? undefined,
|
|
109
109
|
};
|
|
110
110
|
const productSearchPromise = ctx.clients.search.products(searchArgs);
|
|
@@ -198,7 +198,7 @@ exports.Query = {
|
|
|
198
198
|
page: 1,
|
|
199
199
|
count: 1,
|
|
200
200
|
query: term ?? undefined,
|
|
201
|
-
selectedFacets: selectedFacets?.flatMap(
|
|
201
|
+
selectedFacets: selectedFacets?.flatMap(facets_1.transformSelectedFacet) ?? [],
|
|
202
202
|
});
|
|
203
203
|
return {
|
|
204
204
|
url: redirect,
|
|
@@ -219,5 +219,17 @@ exports.Query = {
|
|
|
219
219
|
sellers,
|
|
220
220
|
};
|
|
221
221
|
},
|
|
222
|
+
profile: async (_, { id }, ctx) => {
|
|
223
|
+
const { clients: { commerce }, } = ctx;
|
|
224
|
+
const addresses = await commerce.profile.addresses(id);
|
|
225
|
+
function mapAddressesToList(addressesObj) {
|
|
226
|
+
if (!addressesObj || Object.keys(addressesObj).length === 0) {
|
|
227
|
+
return [];
|
|
228
|
+
}
|
|
229
|
+
return Object.values(addressesObj).map((stringifiedObj) => JSON.parse(stringifiedObj));
|
|
230
|
+
}
|
|
231
|
+
const parsedAddresses = mapAddressesToList(addresses);
|
|
232
|
+
return { addresses: parsedAddresses };
|
|
233
|
+
},
|
|
222
234
|
};
|
|
223
235
|
//# sourceMappingURL=query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../../../src/platforms/vtex/resolvers/query.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../../../src/platforms/vtex/resolvers/query.ts"],"names":[],"mappings":";;;AAWA,yCAA6D;AAK7D,4CAA2E;AAC3E,oDAAgD;AAChD,4CAOwB;AACxB,sCAAwD;AACxD,wCAAwC;AACxC,8CAA2D;AAC3D,6CAA8C;AAEjC,QAAA,KAAK,GAAG;IACnB,OAAO,EAAE,KAAK,EAAE,CAAU,EAAE,EAAE,OAAO,EAAoB,EAAE,GAAY,EAAE,EAAE;QACzE,4CAA4C;QAC5C,MAAM,OAAO,GAAG,IAAA,oBAAW,EAAC,OAAO,CAAC,CAAA;QACpC,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAA;QAClC,MAAM,EAAE,GAAG,IAAA,kBAAS,EAAC,OAAO,CAAC,CAAA;QAC7B,MAAM,IAAI,GAAG,IAAA,iBAAQ,EAAC,OAAO,C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AAC;IACD,OAAO,EAAE,KAAK,EAAE,CAAU,EAAE,EAAE,EAAE,EAAoB,EAAE,GAAY,EAAE,EAAE;QACpE,MAAM,EACJ,OAAO,EAAE,EAAE,QAAQ,EAAE,GACtB,GAAG,GAAG,CAAA;QAEP,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAEtD,SAAS,kBAAkB,CACzB,YAAoC;YAEpC,IAAI,CAAC,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC5D,OAAO,EAAE,CAAA;YACX,CAAC;YAED,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CACpC,CAAC,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAmB,CACjE,CAAA;QACH,CAAC;QAED,MAAM,eAAe,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAA;QAErD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;IACvC,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
type Profile {
|
|
2
|
+
"""
|
|
3
|
+
Collection of user's address
|
|
4
|
+
"""
|
|
5
|
+
addresses: [ProfileAddress]
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type ProfileAddress {
|
|
9
|
+
"""
|
|
10
|
+
ProfileAddress address name/id.
|
|
11
|
+
"""
|
|
12
|
+
addressName: String
|
|
13
|
+
"""
|
|
14
|
+
ProfileAddress address type.
|
|
15
|
+
"""
|
|
16
|
+
addressType: String
|
|
17
|
+
"""
|
|
18
|
+
ProfileAddress postal code.
|
|
19
|
+
"""
|
|
20
|
+
postalCode: String
|
|
21
|
+
"""
|
|
22
|
+
ProfileAddress city.
|
|
23
|
+
"""
|
|
24
|
+
city: String
|
|
25
|
+
"""
|
|
26
|
+
ProfileAddress state.
|
|
27
|
+
"""
|
|
28
|
+
state: String
|
|
29
|
+
"""
|
|
30
|
+
ProfileAddress country.
|
|
31
|
+
"""
|
|
32
|
+
country: String
|
|
33
|
+
"""
|
|
34
|
+
ProfileAddress street.
|
|
35
|
+
"""
|
|
36
|
+
street: String
|
|
37
|
+
"""
|
|
38
|
+
ProfileAddress number.
|
|
39
|
+
"""
|
|
40
|
+
number: String
|
|
41
|
+
"""
|
|
42
|
+
ProfileAddress neighborhood.
|
|
43
|
+
"""
|
|
44
|
+
neighborhood: String
|
|
45
|
+
"""
|
|
46
|
+
ProfileAddress complement.
|
|
47
|
+
"""
|
|
48
|
+
complement: String
|
|
49
|
+
"""
|
|
50
|
+
ProfileAddress reference.
|
|
51
|
+
"""
|
|
52
|
+
reference: String
|
|
53
|
+
"""
|
|
54
|
+
ProfileAddress receiver name.
|
|
55
|
+
"""
|
|
56
|
+
receiverName: String
|
|
57
|
+
"""
|
|
58
|
+
ProfileAddress geo coordinate.
|
|
59
|
+
"""
|
|
60
|
+
geoCoordinate: [Float]
|
|
61
|
+
}
|
|
@@ -338,6 +338,17 @@ type Query {
|
|
|
338
338
|
salesChannel: String
|
|
339
339
|
): SellersData
|
|
340
340
|
@cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600)
|
|
341
|
+
|
|
342
|
+
"""
|
|
343
|
+
Returns information about the profile.
|
|
344
|
+
"""
|
|
345
|
+
profile(
|
|
346
|
+
"""
|
|
347
|
+
Identifier for user.
|
|
348
|
+
"""
|
|
349
|
+
id: String!
|
|
350
|
+
): Profile
|
|
351
|
+
@cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600)
|
|
341
352
|
}
|
|
342
353
|
|
|
343
354
|
"""
|
package/dist/esm/package.json
CHANGED
|
@@ -436,6 +436,40 @@ export type PickupStoreInfo = {
|
|
|
436
436
|
/** Information if the store has pickup enable. */
|
|
437
437
|
isPickupStore?: Maybe<Scalars['Boolean']>;
|
|
438
438
|
};
|
|
439
|
+
export type Profile = {
|
|
440
|
+
__typename?: 'Profile';
|
|
441
|
+
/** Collection of user's address */
|
|
442
|
+
addresses?: Maybe<Array<Maybe<ProfileAddress>>>;
|
|
443
|
+
};
|
|
444
|
+
export type ProfileAddress = {
|
|
445
|
+
__typename?: 'ProfileAddress';
|
|
446
|
+
/** ProfileAddress address name/id. */
|
|
447
|
+
addressName?: Maybe<Scalars['String']>;
|
|
448
|
+
/** ProfileAddress address type. */
|
|
449
|
+
addressType?: Maybe<Scalars['String']>;
|
|
450
|
+
/** ProfileAddress city. */
|
|
451
|
+
city?: Maybe<Scalars['String']>;
|
|
452
|
+
/** ProfileAddress complement. */
|
|
453
|
+
complement?: Maybe<Scalars['String']>;
|
|
454
|
+
/** ProfileAddress country. */
|
|
455
|
+
country?: Maybe<Scalars['String']>;
|
|
456
|
+
/** ProfileAddress geo coordinate. */
|
|
457
|
+
geoCoordinate?: Maybe<Array<Maybe<Scalars['Float']>>>;
|
|
458
|
+
/** ProfileAddress neighborhood. */
|
|
459
|
+
neighborhood?: Maybe<Scalars['String']>;
|
|
460
|
+
/** ProfileAddress number. */
|
|
461
|
+
number?: Maybe<Scalars['String']>;
|
|
462
|
+
/** ProfileAddress postal code. */
|
|
463
|
+
postalCode?: Maybe<Scalars['String']>;
|
|
464
|
+
/** ProfileAddress receiver name. */
|
|
465
|
+
receiverName?: Maybe<Scalars['String']>;
|
|
466
|
+
/** ProfileAddress reference. */
|
|
467
|
+
reference?: Maybe<Scalars['String']>;
|
|
468
|
+
/** ProfileAddress state. */
|
|
469
|
+
state?: Maybe<Scalars['String']>;
|
|
470
|
+
/** ProfileAddress street. */
|
|
471
|
+
street?: Maybe<Scalars['String']>;
|
|
472
|
+
};
|
|
439
473
|
export type Query = {
|
|
440
474
|
__typename?: 'Query';
|
|
441
475
|
/** Returns information about all collections. */
|
|
@@ -446,6 +480,8 @@ export type Query = {
|
|
|
446
480
|
collection: StoreCollection;
|
|
447
481
|
/** Returns the details of a product based on the specified locator. */
|
|
448
482
|
product: StoreProduct;
|
|
483
|
+
/** Returns information about the profile. */
|
|
484
|
+
profile?: Maybe<Profile>;
|
|
449
485
|
/** Returns if there's a redirect for a search. */
|
|
450
486
|
redirect?: Maybe<StoreRedirect>;
|
|
451
487
|
/** Returns the result of a product, facet, or suggestion search. */
|
|
@@ -469,6 +505,9 @@ export type QueryCollectionArgs = {
|
|
|
469
505
|
export type QueryProductArgs = {
|
|
470
506
|
locator: Array<IStoreSelectedFacet>;
|
|
471
507
|
};
|
|
508
|
+
export type QueryProfileArgs = {
|
|
509
|
+
id: Scalars['String'];
|
|
510
|
+
};
|
|
472
511
|
export type QueryRedirectArgs = {
|
|
473
512
|
selectedFacets?: Maybe<Array<IStoreSelectedFacet>>;
|
|
474
513
|
term?: Maybe<Scalars['String']>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/__generated__/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/__generated__/schema.ts"],"names":[],"mappings":"AAq0BC,CAAC;AA+DD,CAAC;AAgVD,CAAC;AAOD,CAAC"}
|
package/dist/esm/src/index.d.ts
CHANGED
|
@@ -97,6 +97,9 @@ export declare const getResolvers: (options: Options) => {
|
|
|
97
97
|
id: string;
|
|
98
98
|
sellers: import("./platforms/vtex/clients/commerce/types/Region").Seller[];
|
|
99
99
|
}>;
|
|
100
|
+
profile: (_: unknown, { id }: import("./__generated__/schema").QueryProfileArgs, ctx: import("./platforms/vtex").Context) => Promise<{
|
|
101
|
+
addresses: import("./platforms/vtex/clients/commerce/types/Profile").ProfileAddress[];
|
|
102
|
+
}>;
|
|
100
103
|
};
|
|
101
104
|
Mutation: {
|
|
102
105
|
validateCart: (_: unknown, { cart: { order }, session }: import("./__generated__/schema").MutationValidateCartArgs, ctx: import("./platforms/vtex").Context) => Promise<{
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { FACET_CROSS_SELLING_MAP } from '../../utils/facets';
|
|
2
|
-
import type {
|
|
2
|
+
import type { StoreMarketingData } from '../../../..';
|
|
3
3
|
import type { Context, Options } from '../../index';
|
|
4
|
+
import type { Channel } from '../../utils/channel';
|
|
5
|
+
import type { Address, AddressInput } from './types/Address';
|
|
4
6
|
import type { Brand } from './types/Brand';
|
|
5
7
|
import type { CategoryTree } from './types/CategoryTree';
|
|
8
|
+
import type { MasterDataResponse } from './types/Newsletter';
|
|
6
9
|
import type { OrderForm, OrderFormInputItem } from './types/OrderForm';
|
|
7
10
|
import type { PortalPagetype } from './types/Portal';
|
|
11
|
+
import type { PortalProduct } from './types/Product';
|
|
8
12
|
import type { Region, RegionInput } from './types/Region';
|
|
9
|
-
import type { Simulation, SimulationArgs, SimulationOptions } from './types/Simulation';
|
|
10
|
-
import type { Session } from './types/Session';
|
|
11
|
-
import type { Channel } from '../../utils/channel';
|
|
12
13
|
import type { SalesChannel } from './types/SalesChannel';
|
|
13
|
-
import type {
|
|
14
|
-
import type { Address, AddressInput } from './types/Address';
|
|
14
|
+
import type { Session } from './types/Session';
|
|
15
15
|
import type { DeliveryMode, SelectedAddress } from './types/ShippingData';
|
|
16
|
-
import type {
|
|
16
|
+
import type { Simulation, SimulationArgs, SimulationOptions } from './types/Simulation';
|
|
17
17
|
type ValueOf<T> = T extends Record<string, infer K> ? K : never;
|
|
18
18
|
export declare const VtexCommerce: ({ account, environment, incrementAddress, subDomainPrefix }: Options, ctx: Context) => {
|
|
19
19
|
catalog: {
|
|
@@ -76,5 +76,8 @@ export declare const VtexCommerce: ({ account, environment, incrementAddress, su
|
|
|
76
76
|
name: string;
|
|
77
77
|
email: string;
|
|
78
78
|
}) => Promise<MasterDataResponse>;
|
|
79
|
+
profile: {
|
|
80
|
+
addresses: (userId: string) => Promise<Record<string, string>>;
|
|
81
|
+
};
|
|
79
82
|
};
|
|
80
83
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parse } from 'cookie';
|
|
1
2
|
import { fetchAPI } from '../fetch';
|
|
2
3
|
import { getStoreCookie, getWithCookie } from '../../utils/cookies';
|
|
3
4
|
const BASE_INIT = {
|
|
@@ -195,6 +196,18 @@ export const VtexCommerce = ({ account, environment, incrementAddress, subDomain
|
|
|
195
196
|
method: 'PATCH',
|
|
196
197
|
}, { storeCookies });
|
|
197
198
|
},
|
|
199
|
+
profile: {
|
|
200
|
+
addresses: async (userId) => {
|
|
201
|
+
const headers = withCookie({
|
|
202
|
+
'content-type': 'application/json',
|
|
203
|
+
'X-FORWARDED-HOST': forwardedHost,
|
|
204
|
+
});
|
|
205
|
+
const cookies = parse(ctx?.headers?.cookie ?? '');
|
|
206
|
+
const VtexIdclientAutCookie = cookies['VtexIdclientAutCookie_' + account];
|
|
207
|
+
headers['VtexIdclientAutCookie'] = VtexIdclientAutCookie;
|
|
208
|
+
return fetchAPI(`${base}/api/profile-system/pvt/profiles/${userId}/addresses`, { headers }, { storeCookies });
|
|
209
|
+
},
|
|
210
|
+
},
|
|
198
211
|
};
|
|
199
212
|
};
|
|
200
213
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/platforms/vtex/clients/commerce/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/platforms/vtex/clients/commerce/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE9B,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAKnC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAoBnE,MAAM,SAAS,GAAG;IAChB,MAAM,EAAE,MAAM;IACd,OAAO,EAAE;QACP,cAAc,EAAE,kBAAkB;KACnC;CACF,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,EAAE,OAAO,EAA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EAAE,CAAC;gBAC1D,MAAM,EAAE,OAAO;aAChB,EACD,EAAE,YAAY,EAAE,CACjB,CAAA;QACH,CAAC;QACD,OAAO,EAAE;YACP,SAAS,EAAE,KAAK,EAAE,MAAc,EAAmC,EAAE;gBACnE,MAAM,OAAO,GAAgB,UAAU,CAAC;oBACtC,cAAc,EAAE,kBAAkB;oBAClC,kBAAkB,EAAE,aAAa;iBAClC,CAAC,CAAA;gBAEF,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,IAAI,EAAE,CAAC,CAAA;gBACjD,MAAM,qBAAqB,GACzB,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,CAAA;gBAC7C,OAAO,CAAC,uBAAuB,CAAC,GAAG,qBAAqB,CAAA;gBAExD,OAAO,QAAQ,CACb,GAAG,IAAI,oCAAoC,MAAM,YAAY,EAC7D,EAAE,OAAO,EAAE,EACX,EAAE,YAAY,EAAE,CACjB,CAAA;YACH,CAAC;SACF;KACF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface Profile {
|
|
2
|
+
addresses: ProfileAddress[];
|
|
3
|
+
}
|
|
4
|
+
export interface ProfileAddress {
|
|
5
|
+
addressName: string;
|
|
6
|
+
addressType: string;
|
|
7
|
+
postalCode: string;
|
|
8
|
+
city: string;
|
|
9
|
+
state: string;
|
|
10
|
+
country: string;
|
|
11
|
+
street: string;
|
|
12
|
+
number: string;
|
|
13
|
+
neighborhood: string;
|
|
14
|
+
complement: string;
|
|
15
|
+
reference: string;
|
|
16
|
+
receiverName: string;
|
|
17
|
+
geoCoordinate: [number, number];
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Profile.js","sourceRoot":"","sources":["../../../../../../../../src/platforms/vtex/clients/commerce/types/Profile.ts"],"names":[],"mappings":""}
|
|
@@ -68,5 +68,8 @@ export declare const getClients: (options: Options, ctx: Context) => {
|
|
|
68
68
|
name: string;
|
|
69
69
|
email: string;
|
|
70
70
|
}) => Promise<import("./commerce/types/Newsletter").MasterDataResponse>;
|
|
71
|
+
profile: {
|
|
72
|
+
addresses: (userId: string) => Promise<Record<string, string>>;
|
|
73
|
+
};
|
|
71
74
|
};
|
|
72
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/platforms/vtex/clients/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/platforms/vtex/clients/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAI5C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAgB,EAAE,GAAY,EAAE,EAAE;IAC3D,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IAC9C,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IAE3C,OAAO;QACL,MAAM;QACN,QAAQ;KACT,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -129,6 +129,9 @@ export declare const getResolvers: (_: Options) => {
|
|
|
129
129
|
id: string;
|
|
130
130
|
sellers: import("./clients/commerce/types/Region").Seller[];
|
|
131
131
|
}>;
|
|
132
|
+
profile: (_: unknown, { id }: import("../..").QueryProfileArgs, ctx: Context) => Promise<{
|
|
133
|
+
addresses: import("./clients/commerce/types/Profile").ProfileAddress[];
|
|
134
|
+
}>;
|
|
132
135
|
};
|
|
133
136
|
Mutation: {
|
|
134
137
|
validateCart: (_: unknown, { cart: { order }, session }: import("../..").MutationValidateCartArgs, ctx: Context) => Promise<{
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { QueryAllCollectionsArgs, QueryAllProductsArgs, QueryCollectionArgs, QueryProductArgs, QuerySearchArgs, QuerySellersArgs, QueryShippingArgs
|
|
1
|
+
import type { QueryAllCollectionsArgs, QueryAllProductsArgs, QueryCollectionArgs, QueryProductArgs, QueryProfileArgs, QueryRedirectArgs, QuerySearchArgs, QuerySellersArgs, QueryShippingArgs } from '../../../__generated__/schema';
|
|
2
2
|
import type { CategoryTree } from '../clients/commerce/types/CategoryTree';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ProfileAddress } from '../clients/commerce/types/Profile';
|
|
4
4
|
import type { SearchArgs } from '../clients/search';
|
|
5
|
+
import type { Context } from '../index';
|
|
5
6
|
export declare const Query: {
|
|
6
7
|
product: (_: unknown, { locator }: QueryProductArgs, ctx: Context) => Promise<import("../utils/enhanceSku").EnhancedSku>;
|
|
7
8
|
collection: (_: unknown, { slug }: QueryCollectionArgs, ctx: Context) => Promise<import("../clients/commerce/types/Portal").CollectionPageType>;
|
|
@@ -69,4 +70,7 @@ export declare const Query: {
|
|
|
69
70
|
id: string;
|
|
70
71
|
sellers: import("../clients/commerce/types/Region").Seller[];
|
|
71
72
|
}>;
|
|
73
|
+
profile: (_: unknown, { id }: QueryProfileArgs, ctx: Context) => Promise<{
|
|
74
|
+
addresses: ProfileAddress[];
|
|
75
|
+
}>;
|
|
72
76
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { FACET_CROSS_SELLING_MAP } from './../utils/facets';
|
|
2
1
|
import { BadRequestError, NotFoundError } from '../../errors';
|
|
3
2
|
import { mutateChannelContext, mutateLocaleContext } from '../utils/contex';
|
|
4
3
|
import { enhanceSku } from '../utils/enhanceSku';
|
|
5
4
|
import { findChannel, findCrossSelling, findLocale, findSkuId, findSlug, transformSelectedFacet, } from '../utils/facets';
|
|
5
|
+
import { isValidSkuId, pickBestSku } from '../utils/sku';
|
|
6
6
|
import { SORT_MAP } from '../utils/sort';
|
|
7
|
+
import { FACET_CROSS_SELLING_MAP } from './../utils/facets';
|
|
7
8
|
import { StoreCollection } from './collection';
|
|
8
|
-
import { isValidSkuId, pickBestSku } from '../utils/sku';
|
|
9
9
|
export const Query = {
|
|
10
10
|
product: async (_, { locator }, ctx) => {
|
|
11
11
|
// Insert channel in context for later usage
|
|
@@ -216,5 +216,17 @@ export const Query = {
|
|
|
216
216
|
sellers,
|
|
217
217
|
};
|
|
218
218
|
},
|
|
219
|
+
profile: async (_, { id }, ctx) => {
|
|
220
|
+
const { clients: { commerce }, } = ctx;
|
|
221
|
+
const addresses = await commerce.profile.addresses(id);
|
|
222
|
+
function mapAddressesToList(addressesObj) {
|
|
223
|
+
if (!addressesObj || Object.keys(addressesObj).length === 0) {
|
|
224
|
+
return [];
|
|
225
|
+
}
|
|
226
|
+
return Object.values(addressesObj).map((stringifiedObj) => JSON.parse(stringifiedObj));
|
|
227
|
+
}
|
|
228
|
+
const parsedAddresses = mapAddressesToList(addresses);
|
|
229
|
+
return { addresses: parsedAddresses };
|
|
230
|
+
},
|
|
219
231
|
};
|
|
220
232
|
//# sourceMappingURL=query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../../../src/platforms/vtex/resolvers/query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../../../src/platforms/vtex/resolvers/query.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAK7D,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,QAAQ,EACR,sBAAsB,GACvB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,E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ProfileAddress {
|
|
9
|
+
"""
|
|
10
|
+
ProfileAddress address name/id.
|
|
11
|
+
"""
|
|
12
|
+
addressName: String
|
|
13
|
+
"""
|
|
14
|
+
ProfileAddress address type.
|
|
15
|
+
"""
|
|
16
|
+
addressType: String
|
|
17
|
+
"""
|
|
18
|
+
ProfileAddress postal code.
|
|
19
|
+
"""
|
|
20
|
+
postalCode: String
|
|
21
|
+
"""
|
|
22
|
+
ProfileAddress city.
|
|
23
|
+
"""
|
|
24
|
+
city: String
|
|
25
|
+
"""
|
|
26
|
+
ProfileAddress state.
|
|
27
|
+
"""
|
|
28
|
+
state: String
|
|
29
|
+
"""
|
|
30
|
+
ProfileAddress country.
|
|
31
|
+
"""
|
|
32
|
+
country: String
|
|
33
|
+
"""
|
|
34
|
+
ProfileAddress street.
|
|
35
|
+
"""
|
|
36
|
+
street: String
|
|
37
|
+
"""
|
|
38
|
+
ProfileAddress number.
|
|
39
|
+
"""
|
|
40
|
+
number: String
|
|
41
|
+
"""
|
|
42
|
+
ProfileAddress neighborhood.
|
|
43
|
+
"""
|
|
44
|
+
neighborhood: String
|
|
45
|
+
"""
|
|
46
|
+
ProfileAddress complement.
|
|
47
|
+
"""
|
|
48
|
+
complement: String
|
|
49
|
+
"""
|
|
50
|
+
ProfileAddress reference.
|
|
51
|
+
"""
|
|
52
|
+
reference: String
|
|
53
|
+
"""
|
|
54
|
+
ProfileAddress receiver name.
|
|
55
|
+
"""
|
|
56
|
+
receiverName: String
|
|
57
|
+
"""
|
|
58
|
+
ProfileAddress geo coordinate.
|
|
59
|
+
"""
|
|
60
|
+
geoCoordinate: [Float]
|
|
61
|
+
}
|
|
@@ -338,6 +338,17 @@ type Query {
|
|
|
338
338
|
salesChannel: String
|
|
339
339
|
): SellersData
|
|
340
340
|
@cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600)
|
|
341
|
+
|
|
342
|
+
"""
|
|
343
|
+
Returns information about the profile.
|
|
344
|
+
"""
|
|
345
|
+
profile(
|
|
346
|
+
"""
|
|
347
|
+
Identifier for user.
|
|
348
|
+
"""
|
|
349
|
+
id: String!
|
|
350
|
+
): Profile
|
|
351
|
+
@cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600)
|
|
341
352
|
}
|
|
342
353
|
|
|
343
354
|
"""
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/api",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.30.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/cjs/src/index.js",
|
|
6
6
|
"typings": "dist/esm/src/index.d.ts",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"volta": {
|
|
84
84
|
"extends": "../../package.json"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "93ded6e2ae1cbc1cd08bf797b0e48dbbb960e344"
|
|
87
87
|
}
|
|
@@ -466,6 +466,42 @@ export type PickupStoreInfo = {
|
|
|
466
466
|
isPickupStore?: Maybe<Scalars['Boolean']>;
|
|
467
467
|
};
|
|
468
468
|
|
|
469
|
+
export type Profile = {
|
|
470
|
+
__typename?: 'Profile';
|
|
471
|
+
/** Collection of user's address */
|
|
472
|
+
addresses?: Maybe<Array<Maybe<ProfileAddress>>>;
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
export type ProfileAddress = {
|
|
476
|
+
__typename?: 'ProfileAddress';
|
|
477
|
+
/** ProfileAddress address name/id. */
|
|
478
|
+
addressName?: Maybe<Scalars['String']>;
|
|
479
|
+
/** ProfileAddress address type. */
|
|
480
|
+
addressType?: Maybe<Scalars['String']>;
|
|
481
|
+
/** ProfileAddress city. */
|
|
482
|
+
city?: Maybe<Scalars['String']>;
|
|
483
|
+
/** ProfileAddress complement. */
|
|
484
|
+
complement?: Maybe<Scalars['String']>;
|
|
485
|
+
/** ProfileAddress country. */
|
|
486
|
+
country?: Maybe<Scalars['String']>;
|
|
487
|
+
/** ProfileAddress geo coordinate. */
|
|
488
|
+
geoCoordinate?: Maybe<Array<Maybe<Scalars['Float']>>>;
|
|
489
|
+
/** ProfileAddress neighborhood. */
|
|
490
|
+
neighborhood?: Maybe<Scalars['String']>;
|
|
491
|
+
/** ProfileAddress number. */
|
|
492
|
+
number?: Maybe<Scalars['String']>;
|
|
493
|
+
/** ProfileAddress postal code. */
|
|
494
|
+
postalCode?: Maybe<Scalars['String']>;
|
|
495
|
+
/** ProfileAddress receiver name. */
|
|
496
|
+
receiverName?: Maybe<Scalars['String']>;
|
|
497
|
+
/** ProfileAddress reference. */
|
|
498
|
+
reference?: Maybe<Scalars['String']>;
|
|
499
|
+
/** ProfileAddress state. */
|
|
500
|
+
state?: Maybe<Scalars['String']>;
|
|
501
|
+
/** ProfileAddress street. */
|
|
502
|
+
street?: Maybe<Scalars['String']>;
|
|
503
|
+
};
|
|
504
|
+
|
|
469
505
|
export type Query = {
|
|
470
506
|
__typename?: 'Query';
|
|
471
507
|
/** Returns information about all collections. */
|
|
@@ -476,6 +512,8 @@ export type Query = {
|
|
|
476
512
|
collection: StoreCollection;
|
|
477
513
|
/** Returns the details of a product based on the specified locator. */
|
|
478
514
|
product: StoreProduct;
|
|
515
|
+
/** Returns information about the profile. */
|
|
516
|
+
profile?: Maybe<Profile>;
|
|
479
517
|
/** Returns if there's a redirect for a search. */
|
|
480
518
|
redirect?: Maybe<StoreRedirect>;
|
|
481
519
|
/** Returns the result of a product, facet, or suggestion search. */
|
|
@@ -509,6 +547,11 @@ export type QueryProductArgs = {
|
|
|
509
547
|
};
|
|
510
548
|
|
|
511
549
|
|
|
550
|
+
export type QueryProfileArgs = {
|
|
551
|
+
id: Scalars['String'];
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
|
|
512
555
|
export type QueryRedirectArgs = {
|
|
513
556
|
selectedFacets?: Maybe<Array<IStoreSelectedFacet>>;
|
|
514
557
|
term?: Maybe<Scalars['String']>;
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
+
import { parse } from 'cookie'
|
|
1
2
|
import type { FACET_CROSS_SELLING_MAP } from '../../utils/facets'
|
|
2
3
|
import { fetchAPI } from '../fetch'
|
|
3
4
|
|
|
4
|
-
import type {
|
|
5
|
+
import type { StoreMarketingData } from '../../../..'
|
|
5
6
|
import type { Context, Options } from '../../index'
|
|
7
|
+
import type { Channel } from '../../utils/channel'
|
|
8
|
+
import { getStoreCookie, getWithCookie } from '../../utils/cookies'
|
|
9
|
+
import type { Address, AddressInput } from './types/Address'
|
|
6
10
|
import type { Brand } from './types/Brand'
|
|
7
11
|
import type { CategoryTree } from './types/CategoryTree'
|
|
12
|
+
import type { MasterDataResponse } from './types/Newsletter'
|
|
8
13
|
import type { OrderForm, OrderFormInputItem } from './types/OrderForm'
|
|
9
14
|
import type { PortalPagetype } from './types/Portal'
|
|
15
|
+
import type { PortalProduct } from './types/Product'
|
|
10
16
|
import type { Region, RegionInput } from './types/Region'
|
|
17
|
+
import type { SalesChannel } from './types/SalesChannel'
|
|
18
|
+
import type { Session } from './types/Session'
|
|
19
|
+
import type { DeliveryMode, SelectedAddress } from './types/ShippingData'
|
|
11
20
|
import type {
|
|
12
21
|
Simulation,
|
|
13
22
|
SimulationArgs,
|
|
14
23
|
SimulationOptions,
|
|
15
24
|
} from './types/Simulation'
|
|
16
|
-
import type { Session } from './types/Session'
|
|
17
|
-
import type { Channel } from '../../utils/channel'
|
|
18
|
-
import type { SalesChannel } from './types/SalesChannel'
|
|
19
|
-
import type { MasterDataResponse } from './types/Newsletter'
|
|
20
|
-
import type { Address, AddressInput } from './types/Address'
|
|
21
|
-
import type { DeliveryMode, SelectedAddress } from './types/ShippingData'
|
|
22
|
-
import { getStoreCookie, getWithCookie } from '../../utils/cookies'
|
|
23
|
-
import type { StoreMarketingData } from '../../../..'
|
|
24
25
|
|
|
25
26
|
type ValueOf<T> = T extends Record<string, infer K> ? K : never
|
|
26
27
|
|
|
@@ -387,5 +388,24 @@ export const VtexCommerce = (
|
|
|
387
388
|
{ storeCookies }
|
|
388
389
|
)
|
|
389
390
|
},
|
|
391
|
+
profile: {
|
|
392
|
+
addresses: async (userId: string): Promise<Record<string, string>> => {
|
|
393
|
+
const headers: HeadersInit = withCookie({
|
|
394
|
+
'content-type': 'application/json',
|
|
395
|
+
'X-FORWARDED-HOST': forwardedHost,
|
|
396
|
+
})
|
|
397
|
+
|
|
398
|
+
const cookies = parse(ctx?.headers?.cookie ?? '')
|
|
399
|
+
const VtexIdclientAutCookie =
|
|
400
|
+
cookies['VtexIdclientAutCookie_' + account]
|
|
401
|
+
headers['VtexIdclientAutCookie'] = VtexIdclientAutCookie
|
|
402
|
+
|
|
403
|
+
return fetchAPI(
|
|
404
|
+
`${base}/api/profile-system/pvt/profiles/${userId}/addresses`,
|
|
405
|
+
{ headers },
|
|
406
|
+
{ storeCookies }
|
|
407
|
+
)
|
|
408
|
+
},
|
|
409
|
+
},
|
|
390
410
|
}
|
|
391
411
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface Profile {
|
|
2
|
+
addresses: ProfileAddress[]
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface ProfileAddress {
|
|
6
|
+
addressName: string
|
|
7
|
+
addressType: string
|
|
8
|
+
postalCode: string
|
|
9
|
+
city: string
|
|
10
|
+
state: string
|
|
11
|
+
country: string
|
|
12
|
+
street: string
|
|
13
|
+
number: string
|
|
14
|
+
neighborhood: string
|
|
15
|
+
complement: string
|
|
16
|
+
reference: string
|
|
17
|
+
receiverName: string
|
|
18
|
+
geoCoordinate: [number, number]
|
|
19
|
+
}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
QueryAllCollectionsArgs,
|
|
3
|
+
QueryAllProductsArgs,
|
|
4
|
+
QueryCollectionArgs,
|
|
5
|
+
QueryProductArgs,
|
|
6
|
+
QueryProfileArgs,
|
|
7
|
+
QueryRedirectArgs,
|
|
8
|
+
QuerySearchArgs,
|
|
9
|
+
QuerySellersArgs,
|
|
10
|
+
QueryShippingArgs,
|
|
11
|
+
} from '../../../__generated__/schema'
|
|
2
12
|
import { BadRequestError, NotFoundError } from '../../errors'
|
|
13
|
+
import type { CategoryTree } from '../clients/commerce/types/CategoryTree'
|
|
14
|
+
import type { ProfileAddress } from '../clients/commerce/types/Profile'
|
|
15
|
+
import type { SearchArgs } from '../clients/search'
|
|
16
|
+
import type { Context } from '../index'
|
|
3
17
|
import { mutateChannelContext, mutateLocaleContext } from '../utils/contex'
|
|
4
18
|
import { enhanceSku } from '../utils/enhanceSku'
|
|
5
19
|
import {
|
|
@@ -10,22 +24,10 @@ import {
|
|
|
10
24
|
findSlug,
|
|
11
25
|
transformSelectedFacet,
|
|
12
26
|
} from '../utils/facets'
|
|
27
|
+
import { isValidSkuId, pickBestSku } from '../utils/sku'
|
|
13
28
|
import { SORT_MAP } from '../utils/sort'
|
|
29
|
+
import { FACET_CROSS_SELLING_MAP } from './../utils/facets'
|
|
14
30
|
import { StoreCollection } from './collection'
|
|
15
|
-
import type {
|
|
16
|
-
QueryAllCollectionsArgs,
|
|
17
|
-
QueryAllProductsArgs,
|
|
18
|
-
QueryCollectionArgs,
|
|
19
|
-
QueryProductArgs,
|
|
20
|
-
QuerySearchArgs,
|
|
21
|
-
QuerySellersArgs,
|
|
22
|
-
QueryShippingArgs,
|
|
23
|
-
QueryRedirectArgs,
|
|
24
|
-
} from '../../../__generated__/schema'
|
|
25
|
-
import type { CategoryTree } from '../clients/commerce/types/CategoryTree'
|
|
26
|
-
import type { Context } from '../index'
|
|
27
|
-
import { isValidSkuId, pickBestSku } from '../utils/sku'
|
|
28
|
-
import type { SearchArgs } from '../clients/search'
|
|
29
31
|
|
|
30
32
|
export const Query = {
|
|
31
33
|
product: async (_: unknown, { locator }: QueryProductArgs, ctx: Context) => {
|
|
@@ -288,7 +290,6 @@ export const Query = {
|
|
|
288
290
|
address,
|
|
289
291
|
}
|
|
290
292
|
},
|
|
291
|
-
|
|
292
293
|
redirect: async (
|
|
293
294
|
_: unknown,
|
|
294
295
|
{ term, selectedFacets }: QueryRedirectArgs,
|
|
@@ -311,7 +312,6 @@ export const Query = {
|
|
|
311
312
|
url: redirect,
|
|
312
313
|
}
|
|
313
314
|
},
|
|
314
|
-
|
|
315
315
|
sellers: async (
|
|
316
316
|
_: unknown,
|
|
317
317
|
{ postalCode, geoCoordinates, country, salesChannel }: QuerySellersArgs,
|
|
@@ -335,4 +335,27 @@ export const Query = {
|
|
|
335
335
|
sellers,
|
|
336
336
|
}
|
|
337
337
|
},
|
|
338
|
+
profile: async (_: unknown, { id }: QueryProfileArgs, ctx: Context) => {
|
|
339
|
+
const {
|
|
340
|
+
clients: { commerce },
|
|
341
|
+
} = ctx
|
|
342
|
+
|
|
343
|
+
const addresses = await commerce.profile.addresses(id)
|
|
344
|
+
|
|
345
|
+
function mapAddressesToList(
|
|
346
|
+
addressesObj: Record<string, string>
|
|
347
|
+
): ProfileAddress[] {
|
|
348
|
+
if (!addressesObj || Object.keys(addressesObj).length === 0) {
|
|
349
|
+
return []
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return Object.values(addressesObj).map(
|
|
353
|
+
(stringifiedObj) => JSON.parse(stringifiedObj) as ProfileAddress
|
|
354
|
+
)
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
const parsedAddresses = mapAddressesToList(addresses)
|
|
358
|
+
|
|
359
|
+
return { addresses: parsedAddresses }
|
|
360
|
+
},
|
|
338
361
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
type Profile {
|
|
2
|
+
"""
|
|
3
|
+
Collection of user's address
|
|
4
|
+
"""
|
|
5
|
+
addresses: [ProfileAddress]
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type ProfileAddress {
|
|
9
|
+
"""
|
|
10
|
+
ProfileAddress address name/id.
|
|
11
|
+
"""
|
|
12
|
+
addressName: String
|
|
13
|
+
"""
|
|
14
|
+
ProfileAddress address type.
|
|
15
|
+
"""
|
|
16
|
+
addressType: String
|
|
17
|
+
"""
|
|
18
|
+
ProfileAddress postal code.
|
|
19
|
+
"""
|
|
20
|
+
postalCode: String
|
|
21
|
+
"""
|
|
22
|
+
ProfileAddress city.
|
|
23
|
+
"""
|
|
24
|
+
city: String
|
|
25
|
+
"""
|
|
26
|
+
ProfileAddress state.
|
|
27
|
+
"""
|
|
28
|
+
state: String
|
|
29
|
+
"""
|
|
30
|
+
ProfileAddress country.
|
|
31
|
+
"""
|
|
32
|
+
country: String
|
|
33
|
+
"""
|
|
34
|
+
ProfileAddress street.
|
|
35
|
+
"""
|
|
36
|
+
street: String
|
|
37
|
+
"""
|
|
38
|
+
ProfileAddress number.
|
|
39
|
+
"""
|
|
40
|
+
number: String
|
|
41
|
+
"""
|
|
42
|
+
ProfileAddress neighborhood.
|
|
43
|
+
"""
|
|
44
|
+
neighborhood: String
|
|
45
|
+
"""
|
|
46
|
+
ProfileAddress complement.
|
|
47
|
+
"""
|
|
48
|
+
complement: String
|
|
49
|
+
"""
|
|
50
|
+
ProfileAddress reference.
|
|
51
|
+
"""
|
|
52
|
+
reference: String
|
|
53
|
+
"""
|
|
54
|
+
ProfileAddress receiver name.
|
|
55
|
+
"""
|
|
56
|
+
receiverName: String
|
|
57
|
+
"""
|
|
58
|
+
ProfileAddress geo coordinate.
|
|
59
|
+
"""
|
|
60
|
+
geoCoordinate: [Float]
|
|
61
|
+
}
|
|
@@ -338,6 +338,17 @@ type Query {
|
|
|
338
338
|
salesChannel: String
|
|
339
339
|
): SellersData
|
|
340
340
|
@cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600)
|
|
341
|
+
|
|
342
|
+
"""
|
|
343
|
+
Returns information about the profile.
|
|
344
|
+
"""
|
|
345
|
+
profile(
|
|
346
|
+
"""
|
|
347
|
+
Identifier for user.
|
|
348
|
+
"""
|
|
349
|
+
id: String!
|
|
350
|
+
): Profile
|
|
351
|
+
@cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600)
|
|
341
352
|
}
|
|
342
353
|
|
|
343
354
|
"""
|