merchi_sdk_ts 1.40.2 → 1.41.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.
package/dist/entities/domain.js
CHANGED
|
@@ -362,6 +362,10 @@ var Domain = /** @class */ (function (_super) {
|
|
|
362
362
|
Domain.property({ type: String }),
|
|
363
363
|
__metadata("design:type", Object)
|
|
364
364
|
], Domain.prototype, "apiSecret", void 0);
|
|
365
|
+
__decorate([
|
|
366
|
+
Domain.property({ type: jsonPropertyType }),
|
|
367
|
+
__metadata("design:type", Object)
|
|
368
|
+
], Domain.prototype, "apiAllowedOrigins", void 0);
|
|
365
369
|
__decorate([
|
|
366
370
|
Domain.property({ type: String }),
|
|
367
371
|
__metadata("design:type", Object)
|
|
@@ -28,6 +28,16 @@ test('can create domain on server', function () {
|
|
|
28
28
|
var sentToServer = Array.from(fetch.mock.calls[0][1]['body'].entries());
|
|
29
29
|
expect(sentToServer).toEqual(data);
|
|
30
30
|
});
|
|
31
|
+
test('serialises apiAllowedOrigins JSON for form data', function () {
|
|
32
|
+
var merchi = new Merchi();
|
|
33
|
+
var domain = new merchi.Domain();
|
|
34
|
+
domain.id = 7;
|
|
35
|
+
domain.apiAllowedOrigins = ['https://shop.example.com', 'https://preview.example.com'];
|
|
36
|
+
var entries = Array.from(domain.toFormData().entries());
|
|
37
|
+
var data = Object.fromEntries(entries);
|
|
38
|
+
expect(data.apiAllowedOrigins).toBe(JSON.stringify(['https://shop.example.com', 'https://preview.example.com']));
|
|
39
|
+
expect(data.apiAllowedOrigins).not.toBe('[object Object]');
|
|
40
|
+
});
|
|
31
41
|
test('serialises jobAgentPolicy JSON for form data', function () {
|
|
32
42
|
var merchi = new Merchi();
|
|
33
43
|
var domain = new merchi.Domain();
|
package/package.json
CHANGED
|
@@ -34,6 +34,20 @@ test('can create domain on server', () => {
|
|
|
34
34
|
expect(sentToServer).toEqual(data);
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
test('serialises apiAllowedOrigins JSON for form data', () => {
|
|
38
|
+
const merchi = new Merchi();
|
|
39
|
+
const domain = new merchi.Domain();
|
|
40
|
+
domain.id = 7;
|
|
41
|
+
domain.apiAllowedOrigins = ['https://shop.example.com', 'https://preview.example.com'];
|
|
42
|
+
const entries = Array.from((domain.toFormData() as any).entries()) as
|
|
43
|
+
Array<[string, string]>;
|
|
44
|
+
const data = Object.fromEntries(entries);
|
|
45
|
+
expect(data.apiAllowedOrigins).toBe(
|
|
46
|
+
JSON.stringify(['https://shop.example.com', 'https://preview.example.com'])
|
|
47
|
+
);
|
|
48
|
+
expect(data.apiAllowedOrigins).not.toBe('[object Object]');
|
|
49
|
+
});
|
|
50
|
+
|
|
37
51
|
test('serialises jobAgentPolicy JSON for form data', () => {
|
|
38
52
|
const merchi = new Merchi();
|
|
39
53
|
const domain = new merchi.Domain();
|
package/src/entities/domain.ts
CHANGED
|
@@ -558,6 +558,9 @@ export class Domain extends Entity {
|
|
|
558
558
|
@Domain.property({type: String})
|
|
559
559
|
public apiSecret?: string | null;
|
|
560
560
|
|
|
561
|
+
@Domain.property({type: jsonPropertyType})
|
|
562
|
+
public apiAllowedOrigins?: string[] | null;
|
|
563
|
+
|
|
561
564
|
@Domain.property({type: String})
|
|
562
565
|
public webflowApiKey?: string | null;
|
|
563
566
|
|