@viu/emporix-sdk 1.0.0

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 (132) hide show
  1. package/CHANGELOG.md +407 -0
  2. package/LICENSE +21 -0
  3. package/README.md +115 -0
  4. package/dist/cart.cjs +214 -0
  5. package/dist/cart.cjs.map +1 -0
  6. package/dist/cart.d.cts +1807 -0
  7. package/dist/cart.d.ts +1807 -0
  8. package/dist/cart.js +4 -0
  9. package/dist/cart.js.map +1 -0
  10. package/dist/category.cjs +97 -0
  11. package/dist/category.cjs.map +1 -0
  12. package/dist/category.d.cts +313 -0
  13. package/dist/category.d.ts +313 -0
  14. package/dist/category.js +4 -0
  15. package/dist/category.js.map +1 -0
  16. package/dist/checkout.cjs +98 -0
  17. package/dist/checkout.cjs.map +1 -0
  18. package/dist/checkout.d.cts +252 -0
  19. package/dist/checkout.d.ts +252 -0
  20. package/dist/checkout.js +4 -0
  21. package/dist/checkout.js.map +1 -0
  22. package/dist/chunk-4BJUCCKJ.js +86 -0
  23. package/dist/chunk-4BJUCCKJ.js.map +1 -0
  24. package/dist/chunk-6UNFMCHZ.js +95 -0
  25. package/dist/chunk-6UNFMCHZ.js.map +1 -0
  26. package/dist/chunk-B56JZNI7.js +49 -0
  27. package/dist/chunk-B56JZNI7.js.map +1 -0
  28. package/dist/chunk-BFQ732VZ.js +11 -0
  29. package/dist/chunk-BFQ732VZ.js.map +1 -0
  30. package/dist/chunk-F3WAQH2E.js +120 -0
  31. package/dist/chunk-F3WAQH2E.js.map +1 -0
  32. package/dist/chunk-GWJ2U2CP.js +14 -0
  33. package/dist/chunk-GWJ2U2CP.js.map +1 -0
  34. package/dist/chunk-HEO34WLO.js +47 -0
  35. package/dist/chunk-HEO34WLO.js.map +1 -0
  36. package/dist/chunk-HKPZI7Y5.js +30 -0
  37. package/dist/chunk-HKPZI7Y5.js.map +1 -0
  38. package/dist/chunk-IEZHGU7F.js +171 -0
  39. package/dist/chunk-IEZHGU7F.js.map +1 -0
  40. package/dist/chunk-KTODT6DV.js +86 -0
  41. package/dist/chunk-KTODT6DV.js.map +1 -0
  42. package/dist/chunk-NM7VDXBR.js +57 -0
  43. package/dist/chunk-NM7VDXBR.js.map +1 -0
  44. package/dist/chunk-OMYVOOSX.js +57 -0
  45. package/dist/chunk-OMYVOOSX.js.map +1 -0
  46. package/dist/chunk-QDABAMVN.js +89 -0
  47. package/dist/chunk-QDABAMVN.js.map +1 -0
  48. package/dist/chunk-RXVVFNYN.js +56 -0
  49. package/dist/chunk-RXVVFNYN.js.map +1 -0
  50. package/dist/chunk-SKX7KCMH.js +23 -0
  51. package/dist/chunk-SKX7KCMH.js.map +1 -0
  52. package/dist/chunk-TLH6SLAF.js +215 -0
  53. package/dist/chunk-TLH6SLAF.js.map +1 -0
  54. package/dist/chunk-Z6PNI5VT.js +142 -0
  55. package/dist/chunk-Z6PNI5VT.js.map +1 -0
  56. package/dist/companies.cjs +58 -0
  57. package/dist/companies.cjs.map +1 -0
  58. package/dist/companies.d.cts +31 -0
  59. package/dist/companies.d.ts +31 -0
  60. package/dist/companies.js +3 -0
  61. package/dist/companies.js.map +1 -0
  62. package/dist/contacts.cjs +51 -0
  63. package/dist/contacts.cjs.map +1 -0
  64. package/dist/contacts.d.cts +28 -0
  65. package/dist/contacts.d.ts +28 -0
  66. package/dist/contacts.js +3 -0
  67. package/dist/contacts.js.map +1 -0
  68. package/dist/context-vKgzZ-5f.d.cts +329 -0
  69. package/dist/context-vKgzZ-5f.d.ts +329 -0
  70. package/dist/customer-groups.cjs +25 -0
  71. package/dist/customer-groups.cjs.map +1 -0
  72. package/dist/customer-groups.d.cts +36 -0
  73. package/dist/customer-groups.d.ts +36 -0
  74. package/dist/customer-groups.js +3 -0
  75. package/dist/customer-groups.js.map +1 -0
  76. package/dist/customer.cjs +262 -0
  77. package/dist/customer.cjs.map +1 -0
  78. package/dist/customer.d.cts +386 -0
  79. package/dist/customer.d.ts +386 -0
  80. package/dist/customer.js +5 -0
  81. package/dist/customer.js.map +1 -0
  82. package/dist/index.cjs +2075 -0
  83. package/dist/index.cjs.map +1 -0
  84. package/dist/index.d.cts +218 -0
  85. package/dist/index.d.ts +218 -0
  86. package/dist/index.js +791 -0
  87. package/dist/index.js.map +1 -0
  88. package/dist/locations.cjs +59 -0
  89. package/dist/locations.cjs.map +1 -0
  90. package/dist/locations.d.cts +30 -0
  91. package/dist/locations.d.ts +30 -0
  92. package/dist/locations.js +3 -0
  93. package/dist/locations.js.map +1 -0
  94. package/dist/media.cjs +123 -0
  95. package/dist/media.cjs.map +1 -0
  96. package/dist/media.d.cts +219 -0
  97. package/dist/media.d.ts +219 -0
  98. package/dist/media.js +3 -0
  99. package/dist/media.js.map +1 -0
  100. package/dist/orders.cjs +98 -0
  101. package/dist/orders.cjs.map +1 -0
  102. package/dist/orders.d.cts +167 -0
  103. package/dist/orders.d.ts +167 -0
  104. package/dist/orders.js +3 -0
  105. package/dist/orders.js.map +1 -0
  106. package/dist/payment.cjs +77 -0
  107. package/dist/payment.cjs.map +1 -0
  108. package/dist/payment.d.cts +110 -0
  109. package/dist/payment.d.ts +110 -0
  110. package/dist/payment.js +5 -0
  111. package/dist/payment.js.map +1 -0
  112. package/dist/price.cjs +88 -0
  113. package/dist/price.cjs.map +1 -0
  114. package/dist/price.d.cts +445 -0
  115. package/dist/price.d.ts +445 -0
  116. package/dist/price.js +4 -0
  117. package/dist/price.js.map +1 -0
  118. package/dist/product.cjs +100 -0
  119. package/dist/product.cjs.map +1 -0
  120. package/dist/product.d.cts +400 -0
  121. package/dist/product.d.ts +400 -0
  122. package/dist/product.js +4 -0
  123. package/dist/product.js.map +1 -0
  124. package/dist/segment.cjs +189 -0
  125. package/dist/segment.cjs.map +1 -0
  126. package/dist/segment.d.cts +241 -0
  127. package/dist/segment.d.ts +241 -0
  128. package/dist/segment.js +5 -0
  129. package/dist/segment.js.map +1 -0
  130. package/dist/types.gen-D1QuqPLs.d.cts +166 -0
  131. package/dist/types.gen-D1QuqPLs.d.ts +166 -0
  132. package/package.json +141 -0
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ // src/services/companies.ts
4
+ var CompaniesService = class {
5
+ constructor(ctx) {
6
+ this.ctx = ctx;
7
+ }
8
+ ctx;
9
+ base() {
10
+ return `/customer-management/${this.ctx.tenant}/legal-entities`;
11
+ }
12
+ /** Lists the legal entities the calling customer is assigned to. */
13
+ async listMine(auth) {
14
+ return this.ctx.http.request({
15
+ method: "GET",
16
+ path: this.base(),
17
+ auth
18
+ });
19
+ }
20
+ /** Fetches a single legal entity by id. */
21
+ async get(legalEntityId, auth) {
22
+ return this.ctx.http.request({
23
+ method: "GET",
24
+ path: `${this.base()}/${legalEntityId}`,
25
+ auth
26
+ });
27
+ }
28
+ /** Creates a legal entity. Requires `customermanagement.legalentity_manage`. */
29
+ async create(input, auth) {
30
+ return this.ctx.http.request({
31
+ method: "POST",
32
+ path: this.base(),
33
+ auth,
34
+ body: input
35
+ });
36
+ }
37
+ /** Patches a legal entity. */
38
+ async update(legalEntityId, patch, auth) {
39
+ return this.ctx.http.request({
40
+ method: "PATCH",
41
+ path: `${this.base()}/${legalEntityId}`,
42
+ auth,
43
+ body: patch
44
+ });
45
+ }
46
+ /** Deletes a legal entity (async cascade on the server). */
47
+ async delete(legalEntityId, auth) {
48
+ await this.ctx.http.request({
49
+ method: "DELETE",
50
+ path: `${this.base()}/${legalEntityId}`,
51
+ auth
52
+ });
53
+ }
54
+ };
55
+
56
+ exports.CompaniesService = CompaniesService;
57
+ //# sourceMappingURL=companies.cjs.map
58
+ //# sourceMappingURL=companies.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/services/companies.ts"],"names":[],"mappings":";;;AAgBO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAA6B,GAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAAA,EAAqB;AAAA,EAArB,GAAA;AAAA,EAErB,IAAA,GAAe;AACrB,IAAA,OAAO,CAAA,qBAAA,EAAwB,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,eAAA,CAAA;AAAA,EAChD;AAAA;AAAA,EAGA,MAAM,SAAS,IAAA,EAA2C;AACxD,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAuB;AAAA,MAC1C,MAAA,EAAQ,KAAA;AAAA,MACR,IAAA,EAAM,KAAK,IAAA,EAAK;AAAA,MAChB;AAAA,KACD,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,GAAA,CAAI,aAAA,EAAuB,IAAA,EAAyC;AACxE,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAqB;AAAA,MACxC,MAAA,EAAQ,KAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,aAAa,CAAA,CAAA;AAAA,MACrC;AAAA,KACD,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,MAAA,CAAO,KAAA,EAA0B,IAAA,EAA4C;AACjF,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAwB;AAAA,MAC3C,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,KAAK,IAAA,EAAK;AAAA,MAChB,IAAA;AAAA,MACA,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,MAAA,CACJ,aAAA,EACA,KAAA,EACA,IAAA,EACsB;AACtB,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAqB;AAAA,MACxC,MAAA,EAAQ,OAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,aAAa,CAAA,CAAA;AAAA,MACrC,IAAA;AAAA,MACA,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,MAAA,CAAO,aAAA,EAAuB,IAAA,EAAkC;AACpE,IAAA,MAAM,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAc;AAAA,MAChC,MAAA,EAAQ,QAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,aAAa,CAAA,CAAA;AAAA,MACrC;AAAA,KACD,CAAA;AAAA,EACH;AACF","file":"companies.cjs","sourcesContent":["import type { ClientContext } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport type {\n LegalEntity,\n LegalEntityCreate,\n LegalEntityUpdate,\n} from \"../generated/customer-management\";\n\n/**\n * Storefront-customer access to Legal Entities.\n *\n * `listMine`/`get` require `customermanagement.legalentity_read_own` on the\n * customer token. `create`/`update`/`delete` require the corresponding\n * `_manage` scopes — typically only granted to Admin-group customers; a 403\n * surfaces as `EmporixInsufficientScopeError`.\n */\nexport class CompaniesService {\n constructor(private readonly ctx: ClientContext) {}\n\n private base(): string {\n return `/customer-management/${this.ctx.tenant}/legal-entities`;\n }\n\n /** Lists the legal entities the calling customer is assigned to. */\n async listMine(auth: AuthContext): Promise<LegalEntity[]> {\n return this.ctx.http.request<LegalEntity[]>({\n method: \"GET\",\n path: this.base(),\n auth,\n });\n }\n\n /** Fetches a single legal entity by id. */\n async get(legalEntityId: string, auth: AuthContext): Promise<LegalEntity> {\n return this.ctx.http.request<LegalEntity>({\n method: \"GET\",\n path: `${this.base()}/${legalEntityId}`,\n auth,\n });\n }\n\n /** Creates a legal entity. Requires `customermanagement.legalentity_manage`. */\n async create(input: LegalEntityCreate, auth: AuthContext): Promise<{ id: string }> {\n return this.ctx.http.request<{ id: string }>({\n method: \"POST\",\n path: this.base(),\n auth,\n body: input,\n });\n }\n\n /** Patches a legal entity. */\n async update(\n legalEntityId: string,\n patch: LegalEntityUpdate,\n auth: AuthContext,\n ): Promise<LegalEntity> {\n return this.ctx.http.request<LegalEntity>({\n method: \"PATCH\",\n path: `${this.base()}/${legalEntityId}`,\n auth,\n body: patch,\n });\n }\n\n /** Deletes a legal entity (async cascade on the server). */\n async delete(legalEntityId: string, auth: AuthContext): Promise<void> {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/${legalEntityId}`,\n auth,\n });\n }\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import { C as ClientContext, b as AuthContext } from './context-vKgzZ-5f.cjs';
2
+ import { L as LegalEntity, f as LegalEntityCreate, h as LegalEntityUpdate } from './types.gen-D1QuqPLs.cjs';
3
+ export { A as AccountLimit, e as CustomerGroupRef, g as LegalEntityType, i as LegalInfo } from './types.gen-D1QuqPLs.cjs';
4
+
5
+ /**
6
+ * Storefront-customer access to Legal Entities.
7
+ *
8
+ * `listMine`/`get` require `customermanagement.legalentity_read_own` on the
9
+ * customer token. `create`/`update`/`delete` require the corresponding
10
+ * `_manage` scopes — typically only granted to Admin-group customers; a 403
11
+ * surfaces as `EmporixInsufficientScopeError`.
12
+ */
13
+ declare class CompaniesService {
14
+ private readonly ctx;
15
+ constructor(ctx: ClientContext);
16
+ private base;
17
+ /** Lists the legal entities the calling customer is assigned to. */
18
+ listMine(auth: AuthContext): Promise<LegalEntity[]>;
19
+ /** Fetches a single legal entity by id. */
20
+ get(legalEntityId: string, auth: AuthContext): Promise<LegalEntity>;
21
+ /** Creates a legal entity. Requires `customermanagement.legalentity_manage`. */
22
+ create(input: LegalEntityCreate, auth: AuthContext): Promise<{
23
+ id: string;
24
+ }>;
25
+ /** Patches a legal entity. */
26
+ update(legalEntityId: string, patch: LegalEntityUpdate, auth: AuthContext): Promise<LegalEntity>;
27
+ /** Deletes a legal entity (async cascade on the server). */
28
+ delete(legalEntityId: string, auth: AuthContext): Promise<void>;
29
+ }
30
+
31
+ export { CompaniesService, LegalEntity, LegalEntityCreate, LegalEntityUpdate };
@@ -0,0 +1,31 @@
1
+ import { C as ClientContext, b as AuthContext } from './context-vKgzZ-5f.js';
2
+ import { L as LegalEntity, f as LegalEntityCreate, h as LegalEntityUpdate } from './types.gen-D1QuqPLs.js';
3
+ export { A as AccountLimit, e as CustomerGroupRef, g as LegalEntityType, i as LegalInfo } from './types.gen-D1QuqPLs.js';
4
+
5
+ /**
6
+ * Storefront-customer access to Legal Entities.
7
+ *
8
+ * `listMine`/`get` require `customermanagement.legalentity_read_own` on the
9
+ * customer token. `create`/`update`/`delete` require the corresponding
10
+ * `_manage` scopes — typically only granted to Admin-group customers; a 403
11
+ * surfaces as `EmporixInsufficientScopeError`.
12
+ */
13
+ declare class CompaniesService {
14
+ private readonly ctx;
15
+ constructor(ctx: ClientContext);
16
+ private base;
17
+ /** Lists the legal entities the calling customer is assigned to. */
18
+ listMine(auth: AuthContext): Promise<LegalEntity[]>;
19
+ /** Fetches a single legal entity by id. */
20
+ get(legalEntityId: string, auth: AuthContext): Promise<LegalEntity>;
21
+ /** Creates a legal entity. Requires `customermanagement.legalentity_manage`. */
22
+ create(input: LegalEntityCreate, auth: AuthContext): Promise<{
23
+ id: string;
24
+ }>;
25
+ /** Patches a legal entity. */
26
+ update(legalEntityId: string, patch: LegalEntityUpdate, auth: AuthContext): Promise<LegalEntity>;
27
+ /** Deletes a legal entity (async cascade on the server). */
28
+ delete(legalEntityId: string, auth: AuthContext): Promise<void>;
29
+ }
30
+
31
+ export { CompaniesService, LegalEntity, LegalEntityCreate, LegalEntityUpdate };
@@ -0,0 +1,3 @@
1
+ export { CompaniesService } from './chunk-RXVVFNYN.js';
2
+ //# sourceMappingURL=companies.js.map
3
+ //# sourceMappingURL=companies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"companies.js"}
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ // src/services/contacts.ts
4
+ var ContactsService = class {
5
+ constructor(ctx) {
6
+ this.ctx = ctx;
7
+ }
8
+ ctx;
9
+ base() {
10
+ return `/customer-management/${this.ctx.tenant}/contact-assignments`;
11
+ }
12
+ /** Lists contact assignments for one legal entity. */
13
+ async listForCompany(legalEntityId, auth) {
14
+ return this.ctx.http.request({
15
+ method: "GET",
16
+ path: this.base(),
17
+ query: { legalEntityId },
18
+ auth
19
+ });
20
+ }
21
+ /** Creates a contact assignment. */
22
+ async assign(input, auth) {
23
+ return this.ctx.http.request({
24
+ method: "POST",
25
+ path: this.base(),
26
+ auth,
27
+ body: input
28
+ });
29
+ }
30
+ /** Patches a contact assignment. */
31
+ async update(contactAssignmentId, patch, auth) {
32
+ return this.ctx.http.request({
33
+ method: "PATCH",
34
+ path: `${this.base()}/${contactAssignmentId}`,
35
+ auth,
36
+ body: patch
37
+ });
38
+ }
39
+ /** Deletes a contact assignment. */
40
+ async unassign(contactAssignmentId, auth) {
41
+ await this.ctx.http.request({
42
+ method: "DELETE",
43
+ path: `${this.base()}/${contactAssignmentId}`,
44
+ auth
45
+ });
46
+ }
47
+ };
48
+
49
+ exports.ContactsService = ContactsService;
50
+ //# sourceMappingURL=contacts.cjs.map
51
+ //# sourceMappingURL=contacts.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/services/contacts.ts"],"names":[],"mappings":";;;AAeO,IAAM,kBAAN,MAAsB;AAAA,EAC3B,YAA6B,GAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAAA,EAAqB;AAAA,EAArB,GAAA;AAAA,EAErB,IAAA,GAAe;AACrB,IAAA,OAAO,CAAA,qBAAA,EAAwB,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,oBAAA,CAAA;AAAA,EAChD;AAAA;AAAA,EAGA,MAAM,cAAA,CAAe,aAAA,EAAuB,IAAA,EAAiD;AAC3F,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAA6B;AAAA,MAChD,MAAA,EAAQ,KAAA;AAAA,MACR,IAAA,EAAM,KAAK,IAAA,EAAK;AAAA,MAChB,KAAA,EAAO,EAAE,aAAA,EAAc;AAAA,MACvB;AAAA,KACD,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,MAAA,CAAO,KAAA,EAAgC,IAAA,EAA4C;AACvF,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAwB;AAAA,MAC3C,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,KAAK,IAAA,EAAK;AAAA,MAChB,IAAA;AAAA,MACA,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,MAAA,CACJ,mBAAA,EACA,KAAA,EACA,IAAA,EAC4B;AAC5B,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAA2B;AAAA,MAC9C,MAAA,EAAQ,OAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,mBAAmB,CAAA,CAAA;AAAA,MAC3C,IAAA;AAAA,MACA,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,QAAA,CAAS,mBAAA,EAA6B,IAAA,EAAkC;AAC5E,IAAA,MAAM,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAc;AAAA,MAChC,MAAA,EAAQ,QAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,mBAAmB,CAAA,CAAA;AAAA,MAC3C;AAAA,KACD,CAAA;AAAA,EACH;AACF","file":"contacts.cjs","sourcesContent":["import type { ClientContext } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport type {\n ContactAssignment,\n ContactAssignmentCreate,\n ContactAssignmentUpdate,\n} from \"../generated/customer-management\";\n\n/**\n * Manages contact assignments linking customers to legal entities.\n *\n * `listForCompany` requires `customermanagement.contactassignment_read`;\n * `assign`/`update`/`unassign` require `_manage`. The query param\n * `legalEntityId` scopes the list to one company.\n */\nexport class ContactsService {\n constructor(private readonly ctx: ClientContext) {}\n\n private base(): string {\n return `/customer-management/${this.ctx.tenant}/contact-assignments`;\n }\n\n /** Lists contact assignments for one legal entity. */\n async listForCompany(legalEntityId: string, auth: AuthContext): Promise<ContactAssignment[]> {\n return this.ctx.http.request<ContactAssignment[]>({\n method: \"GET\",\n path: this.base(),\n query: { legalEntityId },\n auth,\n });\n }\n\n /** Creates a contact assignment. */\n async assign(input: ContactAssignmentCreate, auth: AuthContext): Promise<{ id: string }> {\n return this.ctx.http.request<{ id: string }>({\n method: \"POST\",\n path: this.base(),\n auth,\n body: input,\n });\n }\n\n /** Patches a contact assignment. */\n async update(\n contactAssignmentId: string,\n patch: ContactAssignmentUpdate,\n auth: AuthContext,\n ): Promise<ContactAssignment> {\n return this.ctx.http.request<ContactAssignment>({\n method: \"PATCH\",\n path: `${this.base()}/${contactAssignmentId}`,\n auth,\n body: patch,\n });\n }\n\n /** Deletes a contact assignment. */\n async unassign(contactAssignmentId: string, auth: AuthContext): Promise<void> {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/${contactAssignmentId}`,\n auth,\n });\n }\n}\n"]}
@@ -0,0 +1,28 @@
1
+ import { C as ClientContext, b as AuthContext } from './context-vKgzZ-5f.cjs';
2
+ import { C as ContactAssignment, a as ContactAssignmentCreate, c as ContactAssignmentUpdate } from './types.gen-D1QuqPLs.cjs';
3
+ export { b as ContactAssignmentType } from './types.gen-D1QuqPLs.cjs';
4
+
5
+ /**
6
+ * Manages contact assignments linking customers to legal entities.
7
+ *
8
+ * `listForCompany` requires `customermanagement.contactassignment_read`;
9
+ * `assign`/`update`/`unassign` require `_manage`. The query param
10
+ * `legalEntityId` scopes the list to one company.
11
+ */
12
+ declare class ContactsService {
13
+ private readonly ctx;
14
+ constructor(ctx: ClientContext);
15
+ private base;
16
+ /** Lists contact assignments for one legal entity. */
17
+ listForCompany(legalEntityId: string, auth: AuthContext): Promise<ContactAssignment[]>;
18
+ /** Creates a contact assignment. */
19
+ assign(input: ContactAssignmentCreate, auth: AuthContext): Promise<{
20
+ id: string;
21
+ }>;
22
+ /** Patches a contact assignment. */
23
+ update(contactAssignmentId: string, patch: ContactAssignmentUpdate, auth: AuthContext): Promise<ContactAssignment>;
24
+ /** Deletes a contact assignment. */
25
+ unassign(contactAssignmentId: string, auth: AuthContext): Promise<void>;
26
+ }
27
+
28
+ export { ContactAssignment, ContactAssignmentCreate, ContactAssignmentUpdate, ContactsService };
@@ -0,0 +1,28 @@
1
+ import { C as ClientContext, b as AuthContext } from './context-vKgzZ-5f.js';
2
+ import { C as ContactAssignment, a as ContactAssignmentCreate, c as ContactAssignmentUpdate } from './types.gen-D1QuqPLs.js';
3
+ export { b as ContactAssignmentType } from './types.gen-D1QuqPLs.js';
4
+
5
+ /**
6
+ * Manages contact assignments linking customers to legal entities.
7
+ *
8
+ * `listForCompany` requires `customermanagement.contactassignment_read`;
9
+ * `assign`/`update`/`unassign` require `_manage`. The query param
10
+ * `legalEntityId` scopes the list to one company.
11
+ */
12
+ declare class ContactsService {
13
+ private readonly ctx;
14
+ constructor(ctx: ClientContext);
15
+ private base;
16
+ /** Lists contact assignments for one legal entity. */
17
+ listForCompany(legalEntityId: string, auth: AuthContext): Promise<ContactAssignment[]>;
18
+ /** Creates a contact assignment. */
19
+ assign(input: ContactAssignmentCreate, auth: AuthContext): Promise<{
20
+ id: string;
21
+ }>;
22
+ /** Patches a contact assignment. */
23
+ update(contactAssignmentId: string, patch: ContactAssignmentUpdate, auth: AuthContext): Promise<ContactAssignment>;
24
+ /** Deletes a contact assignment. */
25
+ unassign(contactAssignmentId: string, auth: AuthContext): Promise<void>;
26
+ }
27
+
28
+ export { ContactAssignment, ContactAssignmentCreate, ContactAssignmentUpdate, ContactsService };
@@ -0,0 +1,3 @@
1
+ export { ContactsService } from './chunk-B56JZNI7.js';
2
+ //# sourceMappingURL=contacts.js.map
3
+ //# sourceMappingURL=contacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"contacts.js"}
@@ -0,0 +1,329 @@
1
+ /** Log severity, low → high. */
2
+ type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "silent";
3
+ /** Numeric ordering used for fast comparison. */
4
+ declare const LEVEL: Record<LogLevel, number>;
5
+ /** Services that bind their own logger and are independently level-controllable. */
6
+ type ServiceName = "customer" | "product" | "category" | "cart" | "checkout" | "payment" | "price" | "media" | "segment" | "site" | "session-context" | "customer-management" | "iam" | "orders" | "sales-orders" | "http" | "auth";
7
+ /** Arbitrary structured fields attached to a log line. */
8
+ interface LogFields {
9
+ [key: string]: unknown;
10
+ }
11
+ /** The logger contract consumers may implement or swap. */
12
+ interface Logger {
13
+ level: LogLevel;
14
+ isLevelEnabled(level: LogLevel): boolean;
15
+ trace(msg: string, fields?: LogFields): void;
16
+ debug(msg: string, fields?: LogFields): void;
17
+ info(msg: string, fields?: LogFields): void;
18
+ warn(msg: string, fields?: LogFields): void;
19
+ error(msg: string, fields?: LogFields): void;
20
+ child(bindings: LogFields): Logger;
21
+ }
22
+ /** Object form of logger configuration. */
23
+ interface LoggerObjectConfig {
24
+ level?: LogLevel;
25
+ services?: Partial<Record<ServiceName, LogLevel>>;
26
+ pretty?: boolean;
27
+ redact?: string[];
28
+ }
29
+ /** `false` → noop logger; `Logger` → user-supplied; object → built-in console logger. */
30
+ type LoggerConfig = false | Logger | LoggerObjectConfig;
31
+ /**
32
+ * Resolves the effective level per service following:
33
+ * env per-service > env global > config.services[svc] > config.level > "warn".
34
+ * Runtime `set()` mutates programmatic levels but never overrides env-set ones
35
+ * unless `force` is passed.
36
+ */
37
+ declare class LevelResolver {
38
+ private readonly warn;
39
+ private cfgLevel;
40
+ private cfgServices;
41
+ private forcedServices;
42
+ private forcedGlobal;
43
+ private warned;
44
+ constructor(cfg: LoggerObjectConfig, warn?: (msg: string) => void);
45
+ private envFor;
46
+ private envGlobal;
47
+ /**
48
+ * Effective level for a service. Forced overrides (from `set(..., force)`)
49
+ * take precedence over env vars; otherwise env > programmatic config.
50
+ */
51
+ get(svc: ServiceName): LogLevel;
52
+ /** Numeric effective level for a service. */
53
+ numericLevel(svc: ServiceName): number;
54
+ /** True if `svc`'s effective level allows emitting at `at`. */
55
+ isAtLeast(svc: ServiceName, at: LogLevel): boolean;
56
+ /** Mutates programmatic level (global or one service). Env-set levels are sticky unless `force`. */
57
+ set(level: LogLevel, svc?: ServiceName, force?: boolean): void;
58
+ }
59
+ /** Deep-clones `value`, replacing redacted keys with a mask. AuthContext token is stripped. */
60
+ declare function redact(value: unknown, extra?: string[]): unknown;
61
+ interface Sink {
62
+ log: (...a: unknown[]) => void;
63
+ info: (...a: unknown[]) => void;
64
+ warn: (...a: unknown[]) => void;
65
+ error: (...a: unknown[]) => void;
66
+ }
67
+ /** Creates the built-in console logger. `opts.sink` overrides `console` (used in tests). */
68
+ declare function createConsoleLogger(resolver: LevelResolver, bindings?: LogFields, opts?: {
69
+ pretty?: boolean;
70
+ redact?: string[];
71
+ sink?: Sink;
72
+ }): Logger;
73
+ /** Creates a logger that discards everything. */
74
+ declare function createNoopLogger(): Logger;
75
+
76
+ /** Default Emporix API host. */
77
+ declare const DEFAULT_HOST = "https://api.emporix.io";
78
+ /** A client-credentials credential set (service / custom). */
79
+ interface ServiceCredentials {
80
+ clientId: string;
81
+ secret: string;
82
+ scope?: string;
83
+ }
84
+ /** Storefront credential — anonymous token needs the client id only, no secret. */
85
+ interface StorefrontCredentials {
86
+ clientId: string;
87
+ /**
88
+ * Session context bound at anonymous-login time. Required for
89
+ * `prices.matchByContext` to resolve currency/site/country server-side.
90
+ * `targetLocation` is an ISO country code.
91
+ */
92
+ context?: {
93
+ currency?: string;
94
+ siteCode?: string;
95
+ targetLocation?: string;
96
+ };
97
+ }
98
+ /** User-supplied SDK configuration. */
99
+ interface EmporixConfig {
100
+ tenant: string;
101
+ host?: string;
102
+ credentials: {
103
+ /**
104
+ * Service (client-credentials) credentials. Optional: storefront/SPA apps
105
+ * use only `storefront` (anonymous) + caller-supplied customer tokens and
106
+ * must never ship a backend secret. Required only when a `service`
107
+ * AuthContext is actually used — enforced lazily by the TokenProvider.
108
+ */
109
+ backend?: ServiceCredentials;
110
+ storefront?: StorefrontCredentials;
111
+ custom?: Record<string, ServiceCredentials>;
112
+ };
113
+ tokenProvider?: TokenProvider;
114
+ timeouts?: {
115
+ connectMs?: number;
116
+ readMs?: number;
117
+ };
118
+ retry?: {
119
+ maxAttempts?: number;
120
+ };
121
+ cache?: {
122
+ expirationBufferSeconds?: number;
123
+ maxLifetimeSeconds?: number;
124
+ };
125
+ logger?: LoggerConfig;
126
+ }
127
+ /** Fully-resolved configuration with defaults applied. */
128
+ interface ResolvedConfig {
129
+ tenant: string;
130
+ host: string;
131
+ credentials: EmporixConfig["credentials"];
132
+ tokenProvider: TokenProvider | undefined;
133
+ timeouts: {
134
+ connectMs: number;
135
+ readMs: number;
136
+ };
137
+ retry: {
138
+ maxAttempts: number;
139
+ };
140
+ cache: {
141
+ expirationBufferSeconds: number;
142
+ maxLifetimeSeconds: number;
143
+ };
144
+ logger: LoggerConfig | undefined;
145
+ }
146
+ /** Validates user config and applies defaults. Throws on invalid tenant/credentials. */
147
+ declare function validateConfig(input: EmporixConfig): ResolvedConfig;
148
+
149
+ /** Which token a call should use. */
150
+ type AuthKind = "service" | "customer" | "anonymous" | "raw";
151
+ /** Caller-supplied, per-call auth selector. Never stored on the client. */
152
+ type AuthContext = {
153
+ kind: "service";
154
+ credentials?: string;
155
+ } | {
156
+ kind: "anonymous";
157
+ } | {
158
+ kind: "customer";
159
+ token: string;
160
+ } | {
161
+ kind: "raw";
162
+ token: string;
163
+ };
164
+ /** An obtained anonymous storefront session. */
165
+ interface AnonymousSession {
166
+ accessToken: string;
167
+ refreshToken: string;
168
+ sessionId: string;
169
+ expiresIn: number;
170
+ }
171
+ /**
172
+ * Persistence callback for anonymous sessions. `read` is called once on the
173
+ * first need for an anonymous token to bootstrap a possibly-existing session;
174
+ * `write` is called after every successful login or refresh. `write(null)`
175
+ * means the SDK is invalidating the stored session.
176
+ */
177
+ interface AnonymousSessionStore {
178
+ read(): {
179
+ refreshToken: string;
180
+ sessionId: string;
181
+ } | null;
182
+ write(session: {
183
+ refreshToken: string;
184
+ sessionId: string;
185
+ } | null): void;
186
+ }
187
+ /** Supplies SDK-managed tokens (service/custom + anonymous). May be user-injected. */
188
+ interface TokenProvider {
189
+ /** Service/custom client-credentials token for the named credential set. */
190
+ getToken(credentialSet: string): Promise<string>;
191
+ /** Cached anonymous storefront session (preserves sessionId across refreshes). */
192
+ getAnonymousToken(): Promise<AnonymousSession>;
193
+ /** Refresh the anonymous session, preserving sessionId. */
194
+ refreshAnonymous?(): Promise<AnonymousSession>;
195
+ /** Invalidate a cached SDK-managed token so the next call re-auths. */
196
+ invalidate?(credentialSet: string): void;
197
+ /** Invalidate the cached anonymous session entirely (next call re-logs in). */
198
+ invalidateAnonymous?(): void;
199
+ /**
200
+ * Mark the anonymous access token stale but keep the refresh token, so the
201
+ * next {@link getAnonymousToken} refreshes (preserving sessionId) rather
202
+ * than starting a brand-new session.
203
+ */
204
+ expireAnonymous?(): void;
205
+ /**
206
+ * Install a persistence adapter for the anonymous session. The host (e.g.
207
+ * `EmporixProvider`) calls this at construction so the SDK can bootstrap
208
+ * an existing session and persist refreshes. Idempotent: a later call
209
+ * replaces the previous adapter.
210
+ */
211
+ attachAnonymousStore?(store: AnonymousSessionStore): void;
212
+ /**
213
+ * Subscribe to token-refresh events. Optional — implementations may no-op.
214
+ * Returns an unsubscribe function. `DefaultTokenProvider` emits for the
215
+ * anonymous-login / anonymous-refresh paths.
216
+ */
217
+ onRefresh?(listener: (event: {
218
+ kind: "anonymous" | "customer";
219
+ success: boolean;
220
+ }) => void): () => void;
221
+ }
222
+ /** Tiny constructors for {@link AuthContext}. */
223
+ declare const auth: {
224
+ /** Service/custom credential set (default `backend`). */
225
+ service: (credentials?: string) => AuthContext;
226
+ /** Cached anonymous storefront token. */
227
+ anonymous: () => AuthContext;
228
+ /** Caller-owned customer bearer token. */
229
+ customer: (token: string) => AuthContext;
230
+ /** Exact token, no transformation (SSO / token-exchange). */
231
+ raw: (token: string) => AuthContext;
232
+ };
233
+ /** Resolves an {@link AuthContext} to a concrete bearer token. */
234
+ declare function resolveToken(ctx: AuthContext, provider: TokenProvider): Promise<string>;
235
+ /** SDK-owned token provider: client-credentials service tokens + anonymous session. */
236
+ declare class DefaultTokenProvider implements TokenProvider {
237
+ private readonly cfg;
238
+ private readonly serviceCache;
239
+ private readonly serviceLocks;
240
+ private anon;
241
+ private anonLock;
242
+ private anonStore?;
243
+ private readonly refreshListeners;
244
+ constructor(cfg: ResolvedConfig);
245
+ onRefresh(listener: (event: {
246
+ kind: "anonymous" | "customer";
247
+ success: boolean;
248
+ }) => void): () => void;
249
+ private notifyRefresh;
250
+ attachAnonymousStore(store: AnonymousSessionStore): void;
251
+ private creds;
252
+ private fresh;
253
+ getToken(set: string): Promise<string>;
254
+ private requestServiceToken;
255
+ invalidate(set: string): void;
256
+ private anonFresh;
257
+ getAnonymousToken(): Promise<AnonymousSession>;
258
+ /** Refreshes the anonymous session, preserving its sessionId. */
259
+ refreshAnonymous(): Promise<AnonymousSession>;
260
+ invalidateAnonymous(): void;
261
+ /** Force a stale access token while keeping the refresh token + sessionId. */
262
+ expireAnonymous(): void;
263
+ private stripExpiry;
264
+ private fetchAnonymous;
265
+ }
266
+
267
+ /** A single HTTP request through the SDK. */
268
+ interface RequestOptions {
269
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
270
+ path: string;
271
+ auth: AuthContext;
272
+ query?: Record<string, string | number | undefined>;
273
+ body?: unknown;
274
+ /** Extra request headers (merged before auth; cannot override Authorization). */
275
+ headers?: Record<string, string>;
276
+ /** Per-request abort timeout override (ms). */
277
+ timeoutMs?: number;
278
+ }
279
+ /** Construction options for {@link HttpClient}. */
280
+ interface HttpClientOptions {
281
+ host: string;
282
+ provider: TokenProvider;
283
+ logger: Logger;
284
+ retry: {
285
+ maxAttempts: number;
286
+ };
287
+ timeouts: {
288
+ connectMs: number;
289
+ readMs: number;
290
+ };
291
+ /** Override the retry backoff delay (ms → Promise). Defaults to a real timer. */
292
+ sleep?: (ms: number) => Promise<void>;
293
+ }
294
+ /** Fetch wrapper: auth resolution, JSON parsing, typed error mapping, logging. */
295
+ declare class HttpClient {
296
+ private readonly opts;
297
+ private readonly sleep;
298
+ constructor(opts: HttpClientOptions);
299
+ request<T = unknown>(o: RequestOptions): Promise<T>;
300
+ }
301
+
302
+ /** Shared dependencies every service facade receives. */
303
+ interface ClientContext {
304
+ tenant: string;
305
+ http: HttpClient;
306
+ tokenProvider: TokenProvider;
307
+ logger: Logger;
308
+ }
309
+ /**
310
+ * A cursor-paged collection — `pageNumber`/`pageSize` indexing with a
311
+ * `hasNextPage` signal driven by the source page being full. Used by all
312
+ * paginated services and hooks across the SDK.
313
+ */
314
+ interface PaginatedItems<T> {
315
+ items: T[];
316
+ pageNumber: number;
317
+ pageSize: number;
318
+ hasNextPage: boolean;
319
+ }
320
+ /**
321
+ * Async-iterates every item across pages of a `PaginatedItems<T>` source.
322
+ * Stops when the source reports `hasNextPage: false`.
323
+ *
324
+ * @param fetchPage - given a 1-based page number, returns the page.
325
+ * @param start - first page to fetch (default `1`).
326
+ */
327
+ declare function iterateAll<T>(fetchPage: (pageNumber: number) => Promise<PaginatedItems<T>>, start?: number): AsyncIterable<T>;
328
+
329
+ export { type AnonymousSession as A, type ClientContext as C, DEFAULT_HOST as D, type EmporixConfig as E, HttpClient as H, LEVEL as L, type PaginatedItems as P, type RequestOptions as R, type ServiceCredentials as S, type TokenProvider as T, type AnonymousSessionStore as a, type AuthContext as b, type AuthKind as c, DefaultTokenProvider as d, type HttpClientOptions as e, LevelResolver as f, type LogFields as g, type LogLevel as h, type Logger as i, type LoggerConfig as j, type LoggerObjectConfig as k, type ResolvedConfig as l, type ServiceName as m, type StorefrontCredentials as n, auth as o, createConsoleLogger as p, createNoopLogger as q, iterateAll as r, redact as s, resolveToken as t, validateConfig as v };