@reactionary/core 0.6.5 → 0.6.7

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 (71) hide show
  1. package/capabilities/analytics.capability.js +5 -5
  2. package/capabilities/company-registration.capability.js +9 -0
  3. package/capabilities/company.capability.js +59 -0
  4. package/capabilities/employee-invitation.capability.js +9 -0
  5. package/capabilities/employee.capability.js +9 -0
  6. package/capabilities/index.js +4 -0
  7. package/capabilities/product-recommendations.capability.js +8 -8
  8. package/factories/company-registration.factory.js +0 -0
  9. package/factories/company.factory.js +0 -0
  10. package/factories/employee-invitation.factory.js +0 -0
  11. package/factories/employee.factory.js +0 -0
  12. package/factories/index.js +4 -0
  13. package/package.json +1 -1
  14. package/schemas/models/base.model.js +5 -0
  15. package/schemas/models/checkout.model.js +2 -1
  16. package/schemas/models/company-registration.model.js +14 -0
  17. package/schemas/models/company.model.js +60 -0
  18. package/schemas/models/employee-invitation.model.js +22 -0
  19. package/schemas/models/employee.model.js +20 -0
  20. package/schemas/models/identifiers.model.js +45 -0
  21. package/schemas/models/index.js +4 -0
  22. package/schemas/mutations/company-registration.mutation.js +14 -0
  23. package/schemas/mutations/company.mutation.js +30 -0
  24. package/schemas/mutations/employee-invitation.mutation.js +20 -0
  25. package/schemas/mutations/employee.mutation.js +29 -0
  26. package/schemas/mutations/index.js +4 -0
  27. package/schemas/queries/checkout.query.js +1 -1
  28. package/schemas/queries/company-registration.query.js +8 -0
  29. package/schemas/queries/company.query.js +12 -0
  30. package/schemas/queries/employee-invitation.query.js +8 -0
  31. package/schemas/queries/employee.query.js +19 -0
  32. package/schemas/queries/index.js +4 -0
  33. package/schemas/queries/product-associations.query.js +1 -2
  34. package/schemas/queries/product-reviews.query.js +1 -2
  35. package/schemas/queries/profile.query.js +1 -1
  36. package/schemas/session.schema.js +1 -0
  37. package/src/capabilities/analytics.capability.d.ts +5 -5
  38. package/src/capabilities/company-registration.capability.d.ts +21 -0
  39. package/src/capabilities/company.capability.d.ts +85 -0
  40. package/src/capabilities/employee-invitation.capability.d.ts +34 -0
  41. package/src/capabilities/employee.capability.d.ts +14 -0
  42. package/src/capabilities/index.d.ts +4 -0
  43. package/src/capabilities/product-recommendations.capability.d.ts +8 -8
  44. package/src/client/client.d.ts +6 -1
  45. package/src/factories/company-registration.factory.d.ts +12 -0
  46. package/src/factories/company.factory.d.ts +18 -0
  47. package/src/factories/employee-invitation.factory.d.ts +26 -0
  48. package/src/factories/employee.factory.d.ts +20 -0
  49. package/src/factories/index.d.ts +4 -0
  50. package/src/schemas/models/base.model.d.ts +8 -0
  51. package/src/schemas/models/checkout.model.d.ts +4 -0
  52. package/src/schemas/models/company-registration.model.d.ts +22 -0
  53. package/src/schemas/models/company.model.d.ts +213 -0
  54. package/src/schemas/models/employee-invitation.model.d.ts +88 -0
  55. package/src/schemas/models/employee.model.d.ts +435 -0
  56. package/src/schemas/models/identifiers.model.d.ts +98 -1
  57. package/src/schemas/models/index.d.ts +4 -0
  58. package/src/schemas/mutations/company-registration.mutation.d.ts +26 -0
  59. package/src/schemas/mutations/company.mutation.d.ts +76 -0
  60. package/src/schemas/mutations/employee-invitation.mutation.d.ts +28 -0
  61. package/src/schemas/mutations/employee.mutation.d.ts +39 -0
  62. package/src/schemas/mutations/index.d.ts +4 -0
  63. package/src/schemas/queries/checkout.query.d.ts +15 -16
  64. package/src/schemas/queries/company-registration.query.d.ts +7 -0
  65. package/src/schemas/queries/company.query.d.ts +16 -0
  66. package/src/schemas/queries/employee-invitation.query.d.ts +14 -0
  67. package/src/schemas/queries/employee.query.d.ts +29 -0
  68. package/src/schemas/queries/index.d.ts +4 -0
  69. package/src/schemas/queries/product-reviews.query.d.ts +14 -15
  70. package/src/schemas/queries/profile.query.d.ts +5 -6
  71. package/src/schemas/session.schema.d.ts +1 -0
@@ -37,15 +37,15 @@ class AnalyticsCapability extends BaseCapability {
37
37
  break;
38
38
  }
39
39
  }
40
- async processProductSummaryView(event) {
40
+ async processProductSummaryView(_event) {
41
41
  }
42
- async processProductSummaryClick(event) {
42
+ async processProductSummaryClick(_event) {
43
43
  }
44
- async processProductDetailsView(event) {
44
+ async processProductDetailsView(_event) {
45
45
  }
46
- async processProductAddToCart(event) {
46
+ async processProductAddToCart(_event) {
47
47
  }
48
- async processPurchase(event) {
48
+ async processPurchase(_event) {
49
49
  }
50
50
  }
51
51
  class MulticastAnalyticsCapability extends AnalyticsCapability {
@@ -0,0 +1,9 @@
1
+ import { BaseCapability } from "./base.capability.js";
2
+ class CompanyRegistrationCapability extends BaseCapability {
3
+ getResourceName() {
4
+ return "company-registration";
5
+ }
6
+ }
7
+ export {
8
+ CompanyRegistrationCapability
9
+ };
@@ -0,0 +1,59 @@
1
+ import { BaseCapability } from "./base.capability.js";
2
+ class CompanyCapability extends BaseCapability {
3
+ getResourceName() {
4
+ return "company";
5
+ }
6
+ /**
7
+ * Sets the current/active billing address for the company
8
+ *
9
+ * Usecase: User sets or updates their billing address in their business profile
10
+ *
11
+ * It was a design decision not to support multiple billing addresses. The billing address represents who you are as the commercial
12
+ * entity being billed, and as such it makes sense to have a single authoritative billing address.
13
+ * @param payload
14
+ *
15
+ * NOTE: We are not exposing this for now, as we expect the billing address to be managed from the ERP side
16
+ public abstract setBillingAddress(payload: CompanyMutationSetBillingAddress): Promise<Result<Company, NotFoundError>>;
17
+ */
18
+ /**
19
+ * Create an empty company object with the given id. This can be used as a fallback when company is not found, to avoid returning null and causing errors in the storefront.
20
+ * The storefront can then check if the returned company has an empty name or other fields to determine if it is a valid company or a fallback.
21
+ * @param id
22
+ */
23
+ createEmptyCompany(id) {
24
+ const company = {
25
+ identifier: {
26
+ taxIdentifier: id
27
+ },
28
+ name: "",
29
+ dunsIdentifier: void 0,
30
+ tinIdentifier: void 0,
31
+ logo: void 0,
32
+ status: "blocked",
33
+ pointOfContact: {
34
+ email: "",
35
+ phone: void 0
36
+ },
37
+ billingAddress: {
38
+ firstName: "",
39
+ lastName: "",
40
+ streetAddress: "",
41
+ streetNumber: "",
42
+ city: "",
43
+ region: "",
44
+ postalCode: "",
45
+ countryCode: "",
46
+ identifier: {
47
+ nickName: "default"
48
+ }
49
+ },
50
+ alternateShippingAddresses: [],
51
+ isCustomAddressesAllowed: false,
52
+ isSelfManagementOfShippingAddressesAllowed: false
53
+ };
54
+ return company;
55
+ }
56
+ }
57
+ export {
58
+ CompanyCapability
59
+ };
@@ -0,0 +1,9 @@
1
+ import { BaseCapability } from "./base.capability.js";
2
+ class EmployeeInvitationCapability extends BaseCapability {
3
+ getResourceName() {
4
+ return "employee-invitation";
5
+ }
6
+ }
7
+ export {
8
+ EmployeeInvitationCapability
9
+ };
@@ -0,0 +1,9 @@
1
+ import { BaseCapability } from "./base.capability.js";
2
+ class EmployeeCapability extends BaseCapability {
3
+ getResourceName() {
4
+ return "employees";
5
+ }
6
+ }
7
+ export {
8
+ EmployeeCapability
9
+ };
@@ -16,3 +16,7 @@ export * from "./product-list.capability.js";
16
16
  export * from "./store.capability.js";
17
17
  export * from "./order.capability.js";
18
18
  export * from "./order-search.capability.js";
19
+ export * from "./company-registration.capability.js";
20
+ export * from "./employee.capability.js";
21
+ export * from "./employee-invitation.capability.js";
22
+ export * from "./company.capability.js";
@@ -48,28 +48,28 @@ class ProductRecommendationsCapability extends BaseCapability {
48
48
  }
49
49
  return success([]);
50
50
  }
51
- async getCollection(query) {
51
+ async getCollection(_query) {
52
52
  return success([]);
53
53
  }
54
- async getFrequentlyBoughtTogetherRecommendations(query) {
54
+ async getFrequentlyBoughtTogetherRecommendations(_query) {
55
55
  return [];
56
56
  }
57
- async getSimilarProductsRecommendations(query) {
57
+ async getSimilarProductsRecommendations(_query) {
58
58
  return [];
59
59
  }
60
- async getTrendingInCategoryRecommendations(query) {
60
+ async getTrendingInCategoryRecommendations(_query) {
61
61
  return [];
62
62
  }
63
- async getRelatedProductsRecommendations(query) {
63
+ async getRelatedProductsRecommendations(_query) {
64
64
  return [];
65
65
  }
66
- async getPopularProductsRecommendations(query) {
66
+ async getPopularProductsRecommendations(_query) {
67
67
  return [];
68
68
  }
69
- async getTopPicksProductsRecommendations(query) {
69
+ async getTopPicksProductsRecommendations(_query) {
70
70
  return [];
71
71
  }
72
- async getAlsoViewedProductsRecommendations(query) {
72
+ async getAlsoViewedProductsRecommendations(_query) {
73
73
  return [];
74
74
  }
75
75
  getResourceName() {
File without changes
File without changes
File without changes
File without changes
@@ -1,6 +1,10 @@
1
1
  export * from "./cart.factory.js";
2
2
  export * from "./category.factory.js";
3
3
  export * from "./checkout.factory.js";
4
+ export * from "./company-registration.factory.js";
5
+ export * from "./company.factory.js";
6
+ export * from "./employee-invitation.factory.js";
7
+ export * from "./employee.factory.js";
4
8
  export * from "./identity.factory.js";
5
9
  export * from "./inventory.factory.js";
6
10
  export * from "./order.factory.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactionary/core",
3
- "version": "0.6.5",
3
+ "version": "0.6.7",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./src/index.d.ts",
@@ -19,9 +19,14 @@ const ImageSchema = z.looseObject({
19
19
  width: z.number().optional().meta({ description: "Width of the original image, in pixels, if known" }),
20
20
  height: z.number().optional().meta({ description: "Height of the original image, in pixels, if known" })
21
21
  });
22
+ const PointOfContactSchema = z.looseObject({
23
+ email: z.email().meta({ description: "The contact email for the point of contact" }),
24
+ phone: z.string().optional().meta({ description: "The contact phone number for the point of contact." })
25
+ });
22
26
  export {
23
27
  BaseModelSchema,
24
28
  ImageSchema,
25
29
  PaginationOptionsSchema,
30
+ PointOfContactSchema,
26
31
  createPaginatedResponseSchema
27
32
  };
@@ -1,5 +1,5 @@
1
1
  import * as z from "zod";
2
- import { BaseModelSchema } from "./base.model.js";
2
+ import { BaseModelSchema, PointOfContactSchema } from "./base.model.js";
3
3
  import { CartIdentifierSchema, CheckoutIdentifierSchema, CheckoutItemIdentifierSchema, OrderIdentifierSchema, ProductVariantIdentifierSchema } from "./identifiers.model.js";
4
4
  import { CostBreakDownSchema, ItemCostBreakdownSchema } from "./cost.model.js";
5
5
  import { AddressSchema } from "./profile.model.js";
@@ -25,6 +25,7 @@ const CheckoutSchema = BaseModelSchema.extend({
25
25
  price: CostBreakDownSchema.default(() => CostBreakDownSchema.parse({})),
26
26
  name: z.string().default(""),
27
27
  description: z.string().default(""),
28
+ pointOfContact: PointOfContactSchema,
28
29
  billingAddress: AddressSchema.optional().nullable(),
29
30
  /**
30
31
  * Shipping and billing details can be changed on the checkout, but not items or quantities.
@@ -0,0 +1,14 @@
1
+ import * as z from "zod";
2
+ import { PointOfContactSchema } from "./base.model.js";
3
+ import { CompanyIdentifierSchema, CompanyRegistrationRequestApprovalStatusSchema, CompanyRegistrationRequestIdentifierSchema } from "./identifiers.model.js";
4
+ const CompanyRegistrationRequestSchema = z.object({
5
+ identifier: CompanyRegistrationRequestIdentifierSchema,
6
+ companyIdentifier: CompanyIdentifierSchema,
7
+ name: z.string(),
8
+ pointOfContact: PointOfContactSchema,
9
+ status: CompanyRegistrationRequestApprovalStatusSchema,
10
+ comment: z.string().optional().meta({ description: "An optional comment from the admin reviewing the company registration. This can be used to provide feedback to the user about why their registration was denied or what they need to do to get approved." })
11
+ });
12
+ export {
13
+ CompanyRegistrationRequestSchema
14
+ };
@@ -0,0 +1,60 @@
1
+ import * as z from "zod";
2
+ import { CompanyIdentifierSchema, CompanySearchIdentifierSchema, EmployeeSearchIdentifierSchema } from "./identifiers.model.js";
3
+ import { createPaginatedResponseSchema, ImageSchema, PointOfContactSchema } from "./base.model.js";
4
+ import { AddressSchema } from "./profile.model.js";
5
+ import { EmployeeSchema } from "./employee.model.js";
6
+ const CompanyStatusSchema = z.enum(["active", "blocked"]);
7
+ const CompanySchema = z.looseObject({
8
+ identifier: CompanyIdentifierSchema,
9
+ /**
10
+ * DUN and Bradstreet identifier. Useful for doing automated credit checks
11
+ */
12
+ dunsIdentifier: z.string().optional().meta({ description: "The DUNS number of the company. This is a unique identifier for businesses that can be used for credit reporting and other purposes." }),
13
+ /**
14
+ * EU Tax identifier. Useful for reporting and printing
15
+ */
16
+ tinIdentifier: z.string().optional().meta({ description: "The TIN (Tax Identification Number) of the company. This is a unique identifier for tax purposes." }),
17
+ name: z.string().meta({ description: "The name of the company. This is the human readable name that will be displayed in the UI." }),
18
+ logo: ImageSchema.optional().meta({ description: "The logo of the company. This is the image that will be displayed in the UI to represent the company." }),
19
+ /**
20
+ * future
21
+ parentCompany: CompanyIdentifierSchema.optional(),
22
+ childOrganizationalEntities: z.array(CompanyIdentifierSchema).optional()
23
+ */
24
+ status: CompanyStatusSchema.default("blocked").meta({ description: "The current status of the company in the system. This can be used to determine if the company is active and allowed to perform certain actions, or if it is pending approval or blocked due to violations of terms of service or other issues." }),
25
+ /**
26
+ * The legal contact point for this company. Might not be someone with an actual profile on the site.
27
+ */
28
+ pointOfContact: PointOfContactSchema.meta({ description: "Email and optional phone for the CFO / signatory of the company" }),
29
+ /**
30
+ * Default shipping address if different from default billing address
31
+ */
32
+ shippingAddress: AddressSchema.optional().meta({ description: "The default shipping address for the company. This can be used as the default shipping address for orders placed by this company." }),
33
+ /**
34
+ * The billing address for this company.
35
+ */
36
+ billingAddress: AddressSchema.meta({ description: "The billing address for this company. Not user editable." }),
37
+ /**
38
+ * Other allowed shipping addresses
39
+ */
40
+ alternateShippingAddresses: z.array(AddressSchema).default(() => []).meta({ description: "Other approved shipping addresses for this company" }),
41
+ /**
42
+ * Various indicators the merchant can use to indicate what the company can self-manage.
43
+ */
44
+ /**
45
+ * Can user type in a different shipping address at checkout?
46
+ */
47
+ isCustomAddressesAllowed: z.boolean().default(false).meta({ description: "Whether the company allows using custom shipping addresses that are not in the address book. If false, the user must select from the address book when placing an order." }),
48
+ /**
49
+ * Can admin users manage the address book of the company, adding and removing shipping addresses as needed?
50
+ */
51
+ isSelfManagementOfShippingAddressesAllowed: z.boolean().default(false).meta({ description: "Whether the company allows users to manage their own shipping addresses in an address book. If false, the user must contact support to add or update shipping addresses." })
52
+ });
53
+ const CompanyPaginatedListSchema = createPaginatedResponseSchema(CompanySchema).extend({
54
+ identifier: CompanySearchIdentifierSchema
55
+ });
56
+ export {
57
+ CompanyPaginatedListSchema,
58
+ CompanySchema,
59
+ CompanyStatusSchema
60
+ };
@@ -0,0 +1,22 @@
1
+ import * as z from "zod";
2
+ import { createPaginatedResponseSchema } from "./base.model.js";
3
+ import { EmployeeInvitationIdentifierSchema, EmployeeInvitationSearchIdentifierSchema, EmployeeInvitationStatusSchema, EmployeeRoleSchema, CompanyIdentifierSchema } from "./identifiers.model.js";
4
+ const EmployeeInvitationSchema = z.looseObject({
5
+ identifier: EmployeeInvitationIdentifierSchema,
6
+ company: CompanyIdentifierSchema,
7
+ status: EmployeeInvitationStatusSchema.meta({ description: "The status of the invitation. This can be used to determine if the invitation is still pending, if it has been accepted by the employee, if it has been revoked by an admin, or if it has been rejected by the employee." }),
8
+ email: z.email().meta({ description: "The email of the invited employee. This is the email that the invitation was sent to, and that the employee will use to accept the invitation and create their account." }),
9
+ role: EmployeeRoleSchema.meta({ description: "The role that the invited employee will have in the company. This can be used to determine what permissions and access the employee will have once they accept the invitation." }),
10
+ validUntil: z.string().meta({ description: "The date until the invitation is valid. After this date, the invitation can no longer be accepted by the employee." })
11
+ });
12
+ const EmployeeIssuedInvitationSchema = EmployeeInvitationSchema.extend({
13
+ securityToken: z.string().meta({ description: "The token for the invitation. This is used to accept the invitation and should be kept secret." })
14
+ });
15
+ const EmployeeInvitationPaginatedListSchema = createPaginatedResponseSchema(EmployeeInvitationSchema).extend({
16
+ identifier: EmployeeInvitationSearchIdentifierSchema
17
+ });
18
+ export {
19
+ EmployeeInvitationPaginatedListSchema,
20
+ EmployeeInvitationSchema,
21
+ EmployeeIssuedInvitationSchema
22
+ };
@@ -0,0 +1,20 @@
1
+ import * as z from "zod";
2
+ import { createPaginatedResponseSchema } from "./base.model.js";
3
+ import { IdentityIdentifierSchema, EmployeeRoleSchema, CompanyIdentifierSchema, EmployeeSearchIdentifierSchema } from "./identifiers.model.js";
4
+ import { MonetaryAmountSchema } from "./price.model.js";
5
+ const EmployeeSchema = z.looseObject({
6
+ identifier: IdentityIdentifierSchema,
7
+ company: CompanyIdentifierSchema,
8
+ firstName: z.string().optional().meta({ description: "The first name of the employee. This is the human readable name that will be displayed in the UI." }),
9
+ lastName: z.string().optional().meta({ description: "The last name of the employee. This is the human readable name that will be displayed in the UI." }),
10
+ email: z.email().meta({ description: "The email of the employee. This is the email that the employee uses to log in and access the storefront." }),
11
+ role: EmployeeRoleSchema.meta({ description: "The role of the employee in the company. This can be used to determine what permissions and access the employee has in the storefront." }),
12
+ spendingLimit: MonetaryAmountSchema.optional().meta({ description: "The spending limit for the employee. This can be used to restrict the amount of money the employee can spend when placing orders on behalf of the company." })
13
+ });
14
+ const EmployeePaginatedListSchema = createPaginatedResponseSchema(EmployeeSchema).extend({
15
+ identifier: EmployeeSearchIdentifierSchema
16
+ });
17
+ export {
18
+ EmployeePaginatedListSchema,
19
+ EmployeeSchema
20
+ };
@@ -3,6 +3,9 @@ import { PaginationOptionsSchema } from "./base.model.js";
3
3
  const OrderStatusSchema = z.enum(["AwaitingPayment", "ReleasedToFulfillment", "Shipped", "Cancelled"]).meta({ description: "The current status of the order." });
4
4
  const OrderInventoryStatusSchema = z.enum(["NotAllocated", "Allocated", "Backordered", "Preordered"]).meta({ description: "The inventory release status of the order." });
5
5
  const ProductListTypeSchema = z.enum(["favorite", "wish", "requisition", "shopping"]).meta({ description: 'The type of product list, e.g., "wish" or "favorite".' });
6
+ const EmployeeRoleSchema = z.enum(["admin", "manager", "employee"]);
7
+ const EmployeeInvitationStatusSchema = z.enum(["invited", "accepted", "revoked", "rejected"]);
8
+ const CompanyRegistrationRequestApprovalStatusSchema = z.enum(["pending", "approved", "denied"]);
6
9
  const FacetIdentifierSchema = z.looseObject({
7
10
  key: z.string()
8
11
  });
@@ -135,6 +138,38 @@ const ProductListItemIdentifierSchema = z.looseObject({
135
138
  const PromotionIdentifierSchema = z.looseObject({
136
139
  key: z.string().meta({ description: "The unique identifier for the promotion." })
137
140
  });
141
+ const CompanyIdentifierSchema = z.looseObject({
142
+ /**
143
+ * VAT identifier, used for tax-calculation purposes
144
+ */
145
+ taxIdentifier: z.string().meta({ description: "The unique identifier for the company. Could technically also be the DUNS identifier" })
146
+ });
147
+ const CompanyRegistrationRequestIdentifierSchema = z.looseObject({
148
+ key: z.string().meta({ description: "The unique identifier for the company registration request." })
149
+ });
150
+ const EmployeeInvitationIdentifierSchema = z.looseObject({
151
+ key: z.string().meta({ description: "The unique identifier for the company employee invitation." })
152
+ });
153
+ const EmployeeIdentifierSchema = z.looseObject({
154
+ user: IdentityIdentifierSchema,
155
+ company: CompanyIdentifierSchema
156
+ });
157
+ const CompanySearchIdentifierSchema = z.looseObject({
158
+ paginationOptions: PaginationOptionsSchema.meta({ description: "Pagination options for the search results." })
159
+ });
160
+ const EmployeeInvitationSearchIdentifierSchema = z.looseObject({
161
+ company: CompanyIdentifierSchema.optional().meta({ description: "The identifier for the company to search employee invitations within." }),
162
+ email: z.email().optional().meta({ description: "The email of the invited employee to search for." }),
163
+ paginationOptions: PaginationOptionsSchema.meta({ description: "Pagination options for the search results." })
164
+ });
165
+ const EmployeeSearchIdentifierSchema = z.looseObject({
166
+ company: CompanyIdentifierSchema.meta({ description: "The identifier for the company to search employees within." }),
167
+ email: z.email().optional().meta({ description: "The email of the employee to search for." }),
168
+ firstName: z.string().optional().meta({ description: "The first name of the employee to search for." }),
169
+ lastName: z.string().optional().meta({ description: "The last name of the employee to search for." }),
170
+ role: EmployeeRoleSchema.optional().meta({ description: "The role of the employee to search for." }),
171
+ paginationOptions: PaginationOptionsSchema.meta({ description: "Pagination options for the search results." })
172
+ });
138
173
  export {
139
174
  AddressIdentifierSchema,
140
175
  CartIdentifierSchema,
@@ -142,6 +177,16 @@ export {
142
177
  CategoryIdentifierSchema,
143
178
  CheckoutIdentifierSchema,
144
179
  CheckoutItemIdentifierSchema,
180
+ CompanyIdentifierSchema,
181
+ CompanyRegistrationRequestApprovalStatusSchema,
182
+ CompanyRegistrationRequestIdentifierSchema,
183
+ CompanySearchIdentifierSchema,
184
+ EmployeeIdentifierSchema,
185
+ EmployeeInvitationIdentifierSchema,
186
+ EmployeeInvitationSearchIdentifierSchema,
187
+ EmployeeInvitationStatusSchema,
188
+ EmployeeRoleSchema,
189
+ EmployeeSearchIdentifierSchema,
145
190
  FacetIdentifierSchema,
146
191
  FacetValueIdentifierSchema,
147
192
  FulfillmentCenterIdentifierSchema,
@@ -22,3 +22,7 @@ export * from "./order-search.model.js";
22
22
  export * from "./product-recommendations.model.js";
23
23
  export * from "./product-associations.model.js";
24
24
  export * from "./product-list.model.js";
25
+ export * from "./company.model.js";
26
+ export * from "./company-registration.model.js";
27
+ export * from "./employee.model.js";
28
+ export * from "./employee-invitation.model.js";
@@ -0,0 +1,14 @@
1
+ import * as z from "zod";
2
+ import { PointOfContactSchema } from "../models/base.model.js";
3
+ import { AddressSchema } from "../models/profile.model.js";
4
+ const CompanyRegistrationMutationRegisterSchema = z.object({
5
+ taxIdentifier: z.string().meta({ description: "The unique identifier for the company. Could technically also be the DUNS identifier" }),
6
+ dunsIdentifier: z.string().optional().meta({ description: "The DUNS number of the company. This is a unique identifier for businesses that can be used for credit reporting and other purposes." }),
7
+ tinIdentifier: z.string().optional().meta({ description: "The TIN (Tax Identification Number) of the company. This is a unique identifier for tax purposes." }),
8
+ name: z.string().meta({ description: "The name of the company. This is the human readable name that will be displayed in the UI." }),
9
+ pointOfContact: PointOfContactSchema.meta({ description: "Email and optional phone for the CFO / signatory of the company" }),
10
+ billingAddress: AddressSchema.meta({ description: "The billing address for this company. Not user editable." })
11
+ });
12
+ export {
13
+ CompanyRegistrationMutationRegisterSchema
14
+ };
@@ -0,0 +1,30 @@
1
+ import { AddressIdentifierSchema, CompanyIdentifierSchema } from "../models/identifiers.model.js";
2
+ import { AddressSchema } from "../models/profile.model.js";
3
+ import { BaseMutationSchema } from "./base.mutation.js";
4
+ const CompanyMutationAddShippingAddressSchema = BaseMutationSchema.extend({
5
+ company: CompanyIdentifierSchema,
6
+ address: AddressSchema
7
+ });
8
+ const CompanyMutationRemoveShippingAddressSchema = BaseMutationSchema.extend({
9
+ company: CompanyIdentifierSchema,
10
+ addressIdentifier: AddressIdentifierSchema
11
+ });
12
+ const CompanyMutationUpdateShippingAddressSchema = BaseMutationSchema.extend({
13
+ company: CompanyIdentifierSchema,
14
+ address: AddressSchema
15
+ });
16
+ const CompanyMutationMakeShippingAddressDefaultSchema = BaseMutationSchema.extend({
17
+ company: CompanyIdentifierSchema,
18
+ addressIdentifier: AddressIdentifierSchema
19
+ });
20
+ const CompanyMutationSetBillingAddressSchema = BaseMutationSchema.extend({
21
+ company: CompanyIdentifierSchema,
22
+ address: AddressSchema
23
+ });
24
+ export {
25
+ CompanyMutationAddShippingAddressSchema,
26
+ CompanyMutationMakeShippingAddressDefaultSchema,
27
+ CompanyMutationRemoveShippingAddressSchema,
28
+ CompanyMutationSetBillingAddressSchema,
29
+ CompanyMutationUpdateShippingAddressSchema
30
+ };
@@ -0,0 +1,20 @@
1
+ import * as z from "zod";
2
+ import { EmployeeInvitationIdentifierSchema, EmployeeRoleSchema, CompanyIdentifierSchema } from "../models/identifiers.model.js";
3
+ const EmployeeInvitationMutationInviteEmployeeSchema = z.object({
4
+ company: CompanyIdentifierSchema,
5
+ email: z.email().meta({ description: "The email of the invited employee. This is the email that the invitation will be sent to, and that the employee will use to accept the invitation and create their account." }),
6
+ role: EmployeeRoleSchema.meta({ description: "The role that the invited employee will have in the company. This can be used to determine what permissions and access the employee will have once they accept the invitation." })
7
+ });
8
+ const EmployeeInvitationMutationAcceptInvitationSchema = z.object({
9
+ invitationIdentifier: EmployeeInvitationIdentifierSchema,
10
+ securityToken: z.string().meta({ description: "The security token for accepting the invitation. This is used to verify that the person accepting the invitation has access to the email it was sent to." }),
11
+ currentUserEmail: z.email().meta({ description: "The email of the employee accepting the invitation. This is used to verify that the person accepting the invitation is the same as the one it was sent to." })
12
+ });
13
+ const EmployeeInvitationMutationRevokeInvitationSchema = z.object({
14
+ invitationIdentifier: EmployeeInvitationIdentifierSchema
15
+ });
16
+ export {
17
+ EmployeeInvitationMutationAcceptInvitationSchema,
18
+ EmployeeInvitationMutationInviteEmployeeSchema,
19
+ EmployeeInvitationMutationRevokeInvitationSchema
20
+ };
@@ -0,0 +1,29 @@
1
+ import * as z from "zod";
2
+ import {
3
+ IdentityIdentifierSchema,
4
+ EmployeeRoleSchema,
5
+ CompanyIdentifierSchema
6
+ } from "../models/identifiers.model.js";
7
+ const EmployeeMutationAssignRoleSchema = z.object({
8
+ company: CompanyIdentifierSchema,
9
+ employeeIdentifier: IdentityIdentifierSchema,
10
+ role: EmployeeRoleSchema.meta({
11
+ description: "The role to assign to the employee. This can be used to determine what permissions and access the employee will have in the storefront."
12
+ })
13
+ });
14
+ const EmployeeMutationUnassignRoleSchema = z.object({
15
+ company: CompanyIdentifierSchema,
16
+ employeeIdentifier: IdentityIdentifierSchema,
17
+ role: EmployeeRoleSchema.meta({
18
+ description: "The role to unassign from the employee. This can be used to determine what permissions and access the employee will have in the storefront."
19
+ })
20
+ });
21
+ const EmployeeMutationRemoveEmployeeSchema = z.object({
22
+ company: CompanyIdentifierSchema,
23
+ employeeIdentifier: IdentityIdentifierSchema
24
+ });
25
+ export {
26
+ EmployeeMutationAssignRoleSchema,
27
+ EmployeeMutationRemoveEmployeeSchema,
28
+ EmployeeMutationUnassignRoleSchema
29
+ };
@@ -9,3 +9,7 @@ export * from "./product-reviews.mutation.js";
9
9
  export * from "./profile.mutation.js";
10
10
  export * from "./search.mutation.js";
11
11
  export * from "./checkout.mutation.js";
12
+ export * from "./company-registration.mutation.js";
13
+ export * from "./employee.mutation.js";
14
+ export * from "./employee-invitation.mutation.js";
15
+ export * from "./company.mutation.js";
@@ -1,5 +1,5 @@
1
- import { BaseQuerySchema } from "./base.query.js";
2
1
  import { CheckoutIdentifierSchema } from "../models/identifiers.model.js";
2
+ import { BaseQuerySchema } from "./base.query.js";
3
3
  const CheckoutQueryByIdSchema = BaseQuerySchema.extend({
4
4
  identifier: CheckoutIdentifierSchema
5
5
  });
@@ -0,0 +1,8 @@
1
+ import * as z from "zod";
2
+ import { CompanyRegistrationRequestIdentifierSchema } from "../models/identifiers.model.js";
3
+ const CompanyRegistrationQueryCheckRegistrationStatusSchema = z.object({
4
+ requestIdentifier: CompanyRegistrationRequestIdentifierSchema
5
+ });
6
+ export {
7
+ CompanyRegistrationQueryCheckRegistrationStatusSchema
8
+ };
@@ -0,0 +1,12 @@
1
+ import { CompanyIdentifierSchema, CompanySearchIdentifierSchema } from "../models/identifiers.model.js";
2
+ import { BaseQuerySchema } from "./base.query.js";
3
+ const CompanyQueryByIdSchema = BaseQuerySchema.extend({
4
+ identifier: CompanyIdentifierSchema
5
+ });
6
+ const CompanyQueryListSchema = BaseQuerySchema.extend({
7
+ search: CompanySearchIdentifierSchema
8
+ });
9
+ export {
10
+ CompanyQueryByIdSchema,
11
+ CompanyQueryListSchema
12
+ };
@@ -0,0 +1,8 @@
1
+ import { EmployeeInvitationSearchIdentifierSchema } from "../models/identifiers.model.js";
2
+ import { BaseQuerySchema } from "./base.query.js";
3
+ const EmployeeInvitationQueryListSchema = BaseQuerySchema.extend({
4
+ search: EmployeeInvitationSearchIdentifierSchema
5
+ });
6
+ export {
7
+ EmployeeInvitationQueryListSchema
8
+ };
@@ -0,0 +1,19 @@
1
+ import * as z from "zod";
2
+ import { BaseQuerySchema } from "./base.query.js";
3
+ import {
4
+ CompanyIdentifierSchema,
5
+ EmployeeSearchIdentifierSchema
6
+ } from "../models/identifiers.model.js";
7
+ const EmployeeQueryListSchema = BaseQuerySchema.extend({
8
+ search: EmployeeSearchIdentifierSchema
9
+ });
10
+ const EmployeeQueryByEmailSchema = BaseQuerySchema.extend({
11
+ company: CompanyIdentifierSchema,
12
+ email: z.email().meta({
13
+ description: "The email of the employee to fetch. This can be used to fetch a specific employee by their email address, which is often a unique identifier for users in the system."
14
+ })
15
+ });
16
+ export {
17
+ EmployeeQueryByEmailSchema,
18
+ EmployeeQueryListSchema
19
+ };
@@ -16,3 +16,7 @@ export * from "./order-search.query.js";
16
16
  export * from "./product-recommendations.query.js";
17
17
  export * from "./product-associations.query.js";
18
18
  export * from "./product-list.query.js";
19
+ export * from "./company-registration.query.js";
20
+ export * from "./employee.query.js";
21
+ export * from "./employee-invitation.query.js";
22
+ export * from "./company.query.js";
@@ -1,7 +1,6 @@
1
1
  import * as z from "zod";
2
+ import { ProductIdentifierSchema } from "../models/identifiers.model.js";
2
3
  import { BaseQuerySchema } from "./base.query.js";
3
- import { ProductIdentifierSchema, ProductVariantIdentifierSchema } from "../models/identifiers.model.js";
4
- import { CartItemSchema } from "../models/cart.model.js";
5
4
  const ProductAssociationsGetAccessoriesQuerySchema = BaseQuerySchema.extend({
6
5
  forProduct: ProductIdentifierSchema.describe("The product identifier for which to get accessory recommendations. The provider should return recommendations that are relevant to this product, e.g., products that are frequently bought together, products that are similar in style or category, or products that are popular among users with similar preferences."),
7
6
  numberOfAccessories: z.number().min(1).max(12).meta({ description: "The number of accessory recommendations requested. The provider may return fewer than this number, but should not return more." })
@@ -1,6 +1,5 @@
1
- import * as z from "zod";
2
- import { BaseQuerySchema } from "./base.query.js";
3
1
  import { PaginationOptionsSchema, ProductIdentifierSchema } from "../models/index.js";
2
+ import { BaseQuerySchema } from "./base.query.js";
4
3
  const ProductReviewsListQuerySchema = BaseQuerySchema.extend({
5
4
  product: ProductIdentifierSchema.meta({ description: "The product to list reviews for." }),
6
5
  paginationOptions: PaginationOptionsSchema.optional().meta({ description: "Optional pagination options for the review list." })
@@ -1,5 +1,5 @@
1
- import { BaseQuerySchema } from "./base.query.js";
2
1
  import { IdentityIdentifierSchema } from "../models/identifiers.model.js";
2
+ import { BaseQuerySchema } from "./base.query.js";
3
3
  const ProfileQueryByIdSchema = BaseQuerySchema.extend({
4
4
  identifier: IdentityIdentifierSchema
5
5
  });
@@ -25,6 +25,7 @@ const RequestContextSchema = z.looseObject({
25
25
  languageContext: LanguageContextSchema.default(() => LanguageContextSchema.parse({})).describe("ReadOnly. The language and locale context for the current request."),
26
26
  storeIdentifier: WebStoreIdentifierSchema.default(() => WebStoreIdentifierSchema.parse({})).describe("ReadOnly. The identifier of the current web store making the request."),
27
27
  taxJurisdiction: TaxJurisdictionSchema.default(() => TaxJurisdictionSchema.parse({})).describe("ReadOnly. The tax jurisdiction for the current request, typically derived from the store location or carts billing address"),
28
+ companyIdentifier: z.string().optional().meta({ description: "The company associated with the request, if applicable. This can be used to segment requests and apply different logic or rules based on the business unit." }),
28
29
  correlationId: z.string().default("").meta({ description: "A unique identifier for the request, can be used for tracing and logging purposes." }),
29
30
  isBot: z.boolean().default(false).meta({ description: "Indicates if the request is made by a bot or crawler." }),
30
31
  clientIp: z.string().default("").meta({ description: "The IP address of the client making the request, if available. Mostly for logging purposes" }),