Skip to content

Commit dc2da7e

Browse files
samblacklockrostyk-kanafotskyyyasamanloghmansarawasim1steve-r-west
authored
feat: add missing commits (#5)
* fix: subscription proration policy prefix, offering attach/detach product (#940) BREAKING CHANGE: * feat: add breadcrumb types (#900) * feat: add breadcrumb types * fix: remove an old comment * Feat: Add code to promotion filters (#902) * feat: search code is eq, for promotion codes * Update promotions.d.ts feat: code filter * feat: account association response (#901) * feat: account association response * feat: account association response * Feat: Add code to promotion filters (#902) * feat: search code is eq, for promotion codes * Update promotions.d.ts feat: code filter --------- Co-authored-by: Steve Ramage <steve.ramage@elasticpath.com> Co-authored-by: yasamanloghman <130011231+yasamanloghman@users.noreply.github.com> * feat: plan fixed pricing (#903) * feat: added sort_order field to variation and variation option interfaces (#904) feat: Add new sort_order field to variation and variation option interfaces * chore: updated all jobs node version to 20 except test job (#905) fix: Updated pipeline jobs' node version * fix: updated sort_order field to include the null value (#906) Fix: updated pcm variation sort_order to include null * [MT-16581]feat: CRUD promotion builder (#890) * feat: CRUD promotion builder * fix: remove extra imports * feat: rulepromotion type and endpoint * feat: add the update and create functionality * Create yarn-error.log * feat: preview mode for builder setting , uodate builder types * update type with limitations and conditions * Update rule-promotions.ts * fixed format * fix: remove extra logs * feat: release - promotion builder (#907) * fix: Promotion builder release (#908) * feat: release - promotion builder * fix: update names * fix: Promotion builder release (#910) * feat: release - promotion builder * fix: update names * fix: rules builder condition typo * Feat!: Corrected variation and variation option response and update body types (#909) BREAKING CHANGE: Updated PCM Variation Option response types and names * Fix: Variation option base type and update body corrections (#911) Fix: Update variation and variation body corrections * chore: Revert "Fix: Variation option base type and update body corrections (#911)" (#912) chore: This reverts commit cc4e52297ae3cc4560b4ba92fe3e707dc855a03f. * fix: Variation & variation option update body type (#913) * fix: variation option base type correction and fixed inaccurate update body type for variation and variation option * fix: changed update body types using intersection instead of mapped type * fix: removed intermediate attributes type * feat: Added useTemplateSlugs query param as optional argument to PCM.ExportProducts method (#914) feat: Add useTemplateSlugs query param to PCM.ExportProducts method * feat: subscribers endpoint (#915) * feat: meta type to subscriber, subscription filter type (#916) * feat: product type for offering build request, filter interface (#917) * feat: subscription relationships (#918) * feat: added subscription schedules and jobs endpoints (#919) * feat: Removed billing_day, billing_month_day and status from plans (#920) * feat: Add tags to product interface (#921) * feat: add codes to promotion builder (#922) * feat: add codes to promotion builder * fix: spacing * feat: added update for subscriptions settings (#923) * feat: subscriptions meta timestamp (#924) * feat: Allow null for external reference in schedules (#925) * feat: added GetAttachedPlans and GetAttachedProducts to subs (#927) BREAKING CHANGE * !feat: added CreateState endpoint to subscription, types update (#928) BREAKING CHANGE: types change * fix: Update product component interface (#931) BREAKING CHANGE: * feat(custom apis): adds the custom apis endpoint (#929) * feat(custom apis): adds the custom apis endpoint * updated export * updated validation * updated validation and its fields to optional * updated name for validation * updated to use slug * feat: subscription update endpoint (#932) * refactor(custom apis): updated entries to use id instead of slug (#933) BREAKING CHANGE: changed the endpoint in entries and it now uses customApiId instead of customApiSlug * feat: 🎸 configurable token for account management auth settings (#930) BREAKING CHANGE: 🧨 no ✅ Closes: MT-17759 * fix: Component Option default type (#934) BREAKING CHANGE: * feat: added subscription dunning rules endpoint (#935) * feat: subscription proration policies endpoint (#936) * feat: subscription proration policies endpoint * fix: removed missing fields * feat!: added endpoint to attach proration policy to offerings (#937) BREAKING CHANGE: * feat: added ability to remove attached proration from offering (#938) * feat: subscription offering replace products endpoint (#939) BREAKING CHANGE: removed deprecated endpoint and types * fix: subscription proration policy prefix, offering attach/detach product (#940) BREAKING CHANGE: * chore: cleanup --------- Co-authored-by: Rostyk <34774987+rostyk-kanafotskyy@users.noreply.github.com> Co-authored-by: yasamanloghman <130011231+yasamanloghman@users.noreply.github.com> Co-authored-by: sarawasim1 <111089200+sarawasim1@users.noreply.github.com> Co-authored-by: Steve Ramage <steve.ramage@elasticpath.com> Co-authored-by: Georgios Botzakis <45125702+GeorgeBotzakis@users.noreply.github.com> Co-authored-by: Dubno Petro <34708483+petro97@users.noreply.github.com> Co-authored-by: mahsaelasticpath <76009804+mahsaelasticpath@users.noreply.github.com>
1 parent bd6365d commit dc2da7e

39 files changed

+8801
-337
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,4 @@
114114
"git add"
115115
]
116116
}
117-
}
117+
}

src/endpoints/cart.js

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class CartEndpoint extends BaseExtend {
1616
}
1717

1818
Get() {
19-
const { includes } = this
19+
const {includes} = this
2020

2121
return this.request.send(
2222
buildURL(`${this.endpoint}/${this.cartId}`, {
@@ -27,7 +27,7 @@ class CartEndpoint extends BaseExtend {
2727
}
2828

2929
Items() {
30-
const { includes, sort, limit, offset, filter } = this
30+
const {includes, sort, limit, offset, filter} = this
3131

3232
this.call = this.request.send(
3333
buildURL(`${this.endpoint}/${this.cartId}/items`, {
@@ -51,7 +51,7 @@ class CartEndpoint extends BaseExtend {
5151
return this.request.send(`${this.endpoint}/${this.cartId}/shipping-groups/${shippingGroupId}`, 'GET')
5252
}
5353

54-
CreateShippingGroup(body){
54+
CreateShippingGroup(body) {
5555
const shippingObject = Object.assign(body, {
5656
type: 'shipping-type'
5757
})
@@ -161,7 +161,7 @@ class CartEndpoint extends BaseExtend {
161161
BulkAddCartCustomDiscount(body, options) {
162162
return this.request.send(`${this.endpoint}/${this.cartId}/custom-discounts`, 'POST', {
163163
data: body,
164-
...(options && { options })
164+
...(options && {options})
165165
})
166166
}
167167

@@ -179,7 +179,7 @@ class CartEndpoint extends BaseExtend {
179179
BulkAdd(body, options) {
180180
return this.request.send(`${this.endpoint}/${this.cartId}/items`, 'POST', {
181181
data: body,
182-
...(options && { options })
182+
...(options && {options})
183183
})
184184
}
185185

@@ -215,6 +215,48 @@ class CartEndpoint extends BaseExtend {
215215
)
216216
}
217217

218+
AddAccountAssociation(accountId, token) {
219+
const body = [
220+
{
221+
type: 'account',
222+
id: accountId
223+
}
224+
]
225+
return this.request.send(
226+
`${this.endpoint}/${this.cartId}/relationships/accounts`,
227+
'POST',
228+
body,
229+
undefined,
230+
this,
231+
true,
232+
null,
233+
token
234+
? { 'EP-ACCOUNT-MANAGEMENT-AUTHENTICATION-TOKEN': token }
235+
: undefined
236+
)
237+
}
238+
239+
RemoveAccountAssociation(accountId, token) {
240+
const body = [
241+
{
242+
type: 'account',
243+
id: accountId
244+
}
245+
]
246+
return this.request.send(
247+
`${this.endpoint}/${this.cartId}/relationships/accounts`,
248+
'DELETE',
249+
body,
250+
undefined,
251+
this,
252+
true,
253+
null,
254+
token
255+
? { 'EP-ACCOUNT-MANAGEMENT-AUTHENTICATION-TOKEN': token }
256+
: undefined
257+
)
258+
}
259+
218260
RemoveItem(itemId) {
219261
return this.request.send(
220262
`${this.endpoint}/${this.cartId}/items/${itemId}`,
@@ -232,7 +274,7 @@ class CartEndpoint extends BaseExtend {
232274
return this.request.send(
233275
`${this.endpoint}/${this.cartId}/items/${itemId}`,
234276
'PUT',
235-
{ ...body, ...data },
277+
{...body, ...data},
236278
null,
237279
null,
238280
true,
@@ -242,7 +284,7 @@ class CartEndpoint extends BaseExtend {
242284
}
243285

244286
UpdateItems(items) {
245-
const body = items.map(({ id, quantity, type, ...rest }) =>
287+
const body = items.map(({id, quantity, type, ...rest}) =>
246288
buildCartItemData(id, quantity, type, rest)
247289
)
248290

@@ -278,7 +320,7 @@ class CartEndpoint extends BaseExtend {
278320
BulkAddItemTax(body, options) {
279321
return this.request.send(`${this.endpoint}/${this.cartId}/taxes`, 'POST', {
280322
data: body,
281-
...(options && { options })
323+
...(options && {options})
282324
})
283325
}
284326

@@ -362,7 +404,7 @@ class CartEndpoint extends BaseExtend {
362404
'POST',
363405
{
364406
data: body,
365-
...(options && { options })
407+
...(options && {options})
366408
},
367409
token
368410
)

src/endpoints/catalogs.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ class Products extends CRUDExtend {
9999
this.endpoint = 'products'
100100
}
101101

102-
103102
GetCatalogReleaseProduct({ catalogId, releaseId, productId, token = null }) {
104103
return this.request.send(
105104
`catalogs/${catalogId}/releases/${releaseId}/${this.endpoint}/${productId}`,
@@ -129,16 +128,24 @@ class Products extends CRUDExtend {
129128
)
130129
}
131130

132-
GetCatalogReleaseProductChildren({ catalogId, releaseId, productId, token = null }) {
131+
GetCatalogReleaseProductChildren({
132+
catalogId,
133+
releaseId,
134+
productId,
135+
token = null
136+
}) {
133137
const { limit, offset, includes, sort, filter } = this
134138
return this.request.send(
135-
buildURL(`catalogs/${catalogId}/releases/${releaseId}/${this.endpoint}/${productId}/relationships/children`, {
136-
includes,
137-
sort,
138-
limit,
139-
offset,
140-
filter
141-
}),
139+
buildURL(
140+
`catalogs/${catalogId}/releases/${releaseId}/${this.endpoint}/${productId}/relationships/children`,
141+
{
142+
includes,
143+
sort,
144+
limit,
145+
offset,
146+
filter
147+
}
148+
),
142149
'GET',
143150
undefined,
144151
token,
@@ -196,10 +203,6 @@ class Products extends CRUDExtend {
196203
)
197204
}
198205

199-
/**
200-
* @deprecated The method should not be used. Instead, use
201-
* @function GetCatalogProducts
202-
*/
203206
GetProductsInCatalogRelease({ catalogId, releaseId, token = null }) {
204207
const { limit, offset, includes, sort, filter } = this
205208

src/endpoints/custom-apis.js

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
import CRUDExtend from '../extends/crud'
2+
3+
import { buildURL } from '../utils/helpers'
4+
5+
class CustomApisEndpoint extends CRUDExtend {
6+
constructor(endpoint) {
7+
super(endpoint)
8+
9+
this.endpoint = 'settings/extensions/custom-apis'
10+
}
11+
12+
Create(body) {
13+
return this.request.send(
14+
this.endpoint,
15+
'POST',
16+
body
17+
)
18+
}
19+
20+
Update(id, body) {
21+
return this.request.send(
22+
`${this.endpoint}/${id}`,
23+
'PUT',
24+
body
25+
)
26+
}
27+
28+
GetFields(customApiId) {
29+
const { limit, offset, sort } = this
30+
31+
return this.request.send(
32+
buildURL(`${this.endpoint}/${customApiId}/fields`, {
33+
limit,
34+
offset,
35+
sort
36+
}),
37+
'GET'
38+
)
39+
}
40+
41+
GetField(customApiId, customApiFieldId) {
42+
return this.request.send(
43+
`${this.endpoint}/${customApiId}/fields/${customApiFieldId}`,
44+
'GET'
45+
)
46+
}
47+
48+
CreateField(customApiId, body) {
49+
return this.request.send(
50+
`${this.endpoint}/${customApiId}/fields`,
51+
'POST',
52+
body
53+
)
54+
}
55+
56+
UpdateField(customApiId, customApiFieldId, body) {
57+
return this.request.send(
58+
`${this.endpoint}/${customApiId}/fields/${customApiFieldId}`,
59+
'PUT',
60+
body
61+
)
62+
}
63+
64+
DeleteField(customApiId, customApiFieldId) {
65+
return this.request.send(
66+
`${this.endpoint}/${customApiId}/fields/${customApiFieldId}`,
67+
'DELETE'
68+
)
69+
}
70+
71+
GetEntries(customApiId) {
72+
const { limit, offset, sort, filter } = this
73+
74+
return this.request.send(
75+
buildURL(`${this.endpoint}/${customApiId}/entries`, {
76+
limit,
77+
offset,
78+
sort,
79+
filter
80+
}),
81+
'GET'
82+
)
83+
}
84+
85+
GetEntry(customApiId, customApiEntryId) {
86+
return this.request.send(
87+
`${this.endpoint}/${customApiId}/entries/${customApiEntryId}`,
88+
'GET'
89+
)
90+
}
91+
92+
CreateEntry(customApiId, body) {
93+
return this.request.send(
94+
`${this.endpoint}/${customApiId}/entries`,
95+
'POST',
96+
body
97+
)
98+
}
99+
100+
UpdateEntry(customApiId, customApiEntryId, body) {
101+
return this.request.send(
102+
`${this.endpoint}/${customApiId}/entries/${customApiEntryId}`,
103+
'PUT',
104+
body
105+
)
106+
}
107+
108+
DeleteEntry(customApiId, customApiEntryId) {
109+
return this.request.send(
110+
`${this.endpoint}/${customApiId}/entries/${customApiEntryId}`,
111+
'DELETE'
112+
)
113+
}
114+
}
115+
116+
export default CustomApisEndpoint

src/endpoints/pcm.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@ class PCMEndpoint extends CRUDExtend {
6262
return this.request.send(`${this.endpoint}/detach_nodes`, 'POST', body)
6363
}
6464

65-
ExportProducts(filter) {
65+
ExportProducts(filter, useTemplateSlugs) {
6666
return this.request.send(
6767
buildURL(`${this.endpoint}/export`, {
68-
filter
68+
filter,
69+
useTemplateSlugs
6970
}),
7071
'POST'
7172
)

src/endpoints/promotions.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@ class PromotionsEndpoint extends CRUDExtend {
1212
return this.request.send(`${this.endpoint}/attributes`, 'GET')
1313
}
1414

15-
Codes(promotionId) {
16-
const { limit, offset } = this
17-
return this.request.send(
18-
buildURL(`${this.endpoint}/${promotionId}/codes`, {
19-
limit,
20-
offset
21-
}),
22-
'GET'
15+
Codes(promotionId, token = null) {
16+
const { limit, offset, filter } = this
17+
return this.request.send(
18+
buildURL(`${this.endpoint}/${promotionId}/codes`, {
19+
limit,
20+
offset,
21+
filter
22+
}),
23+
'GET',
24+
undefined,
25+
token,
26+
this
2327
)
2428
}
2529

0 commit comments

Comments
 (0)