@merchi/sdk 1.42.30 → 1.42.31
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/variation.d.ts +15 -0
- package/dist/entities/variation.js +13 -0
- package/dist/entities/variation.test.js +20 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/entities/variation.test.ts +21 -0
- package/src/entities/variation.ts +26 -0
- package/src/index.ts +2 -0
|
@@ -5,6 +5,20 @@ import { Job } from './job.js';
|
|
|
5
5
|
import { VariationField } from './variation_field.js';
|
|
6
6
|
import { VariationOption } from './variation_option.js';
|
|
7
7
|
import { VariationsGroup } from './variations_group.js';
|
|
8
|
+
/** Appearance of a text box the customer added in the designer. */
|
|
9
|
+
export interface DesignerTextStyle {
|
|
10
|
+
colour?: string;
|
|
11
|
+
textSize?: number;
|
|
12
|
+
font?: string;
|
|
13
|
+
align?: string;
|
|
14
|
+
x?: number;
|
|
15
|
+
y?: number;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
18
|
+
rotation?: number;
|
|
19
|
+
scaleX?: number;
|
|
20
|
+
scaleY?: number;
|
|
21
|
+
}
|
|
8
22
|
export declare class Variation extends Entity {
|
|
9
23
|
protected static resourceName: string;
|
|
10
24
|
protected static singularName: string;
|
|
@@ -12,6 +26,7 @@ export declare class Variation extends Entity {
|
|
|
12
26
|
archived?: Date | null;
|
|
13
27
|
id?: number;
|
|
14
28
|
value?: string | null;
|
|
29
|
+
textStyle?: DesignerTextStyle | null;
|
|
15
30
|
currency?: string;
|
|
16
31
|
cost?: number;
|
|
17
32
|
quantity?: number;
|
|
@@ -27,6 +27,15 @@ import { Entity } from '../entity.js';
|
|
|
27
27
|
import { Job } from './job.js';
|
|
28
28
|
import { VariationField } from './variation_field.js';
|
|
29
29
|
import { VariationsGroup } from './variations_group.js';
|
|
30
|
+
/**
|
|
31
|
+
* Runtime type tag only. The API returns `textStyle` as JSON; the entity
|
|
32
|
+
* layer refuses `Object` from decorator metadata.
|
|
33
|
+
*/
|
|
34
|
+
var textStylePropertyType = /** @class */ (function () {
|
|
35
|
+
function textStylePropertyType() {
|
|
36
|
+
}
|
|
37
|
+
return textStylePropertyType;
|
|
38
|
+
}());
|
|
30
39
|
var Variation = /** @class */ (function (_super) {
|
|
31
40
|
__extends(Variation, _super);
|
|
32
41
|
function Variation() {
|
|
@@ -47,6 +56,10 @@ var Variation = /** @class */ (function (_super) {
|
|
|
47
56
|
Variation.property({ type: String }),
|
|
48
57
|
__metadata("design:type", Object)
|
|
49
58
|
], Variation.prototype, "value", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
Variation.property({ type: textStylePropertyType }),
|
|
61
|
+
__metadata("design:type", Object)
|
|
62
|
+
], Variation.prototype, "textStyle", void 0);
|
|
50
63
|
__decorate([
|
|
51
64
|
Variation.property(),
|
|
52
65
|
__metadata("design:type", String)
|
|
@@ -4,3 +4,23 @@ test('can make Variation', function () {
|
|
|
4
4
|
var variation = new merchi.Variation();
|
|
5
5
|
expect(variation).toBeTruthy();
|
|
6
6
|
});
|
|
7
|
+
test('textStyle keeps the designer text box from the server', function () {
|
|
8
|
+
var merchi = new Merchi();
|
|
9
|
+
var variation = new merchi.Variation();
|
|
10
|
+
var textStyle = {
|
|
11
|
+
colour: '#112233',
|
|
12
|
+
textSize: 56,
|
|
13
|
+
font: 'Oswald',
|
|
14
|
+
align: 'center',
|
|
15
|
+
x: 12.5,
|
|
16
|
+
y: 40,
|
|
17
|
+
width: 180,
|
|
18
|
+
height: 48,
|
|
19
|
+
rotation: 0,
|
|
20
|
+
scaleX: 1,
|
|
21
|
+
scaleY: 1,
|
|
22
|
+
};
|
|
23
|
+
variation.fromJson({ textStyle: textStyle });
|
|
24
|
+
expect(variation.textStyle).toEqual(textStyle);
|
|
25
|
+
expect(variation.toJson().textStyle).toEqual(textStyle);
|
|
26
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -88,4 +88,5 @@ import * as request from './request.js';
|
|
|
88
88
|
import * as util from './util/index.js';
|
|
89
89
|
import * as pricing from './pricing/index.js';
|
|
90
90
|
import { toastNotifications } from './toasts.js';
|
|
91
|
+
export type { DesignerTextStyle } from './entities/variation.js';
|
|
91
92
|
export { constants, request, util, pricing, toastNotifications, Address, AgentConversation, AgentTokenUsage, AgentSkill, AgentSkillVersion, AgentSkillApproval, DomainChatSettings, SupportConversation, SupportMessage, Assignment, AutomaticPaymentRelationship, Bank, Cart, CartItem, CartShipmentGroup, CartShipmentQuote, Category, Company, CompanyInvitation, ProductForm, ProductFormVersion, CountryTax, Discount, DiscountGroup, Domain, DomainInvitation, DomainTag, Draft, DraftComment, DraftTemplate, EmailAddress, EmailCounter, EnrolledDomain, Entity, EmbedDescriptor, ExchangeRate, InternalTag, Inventory, InventoryUnitVariation, Invoice, Item, Job, JobComment, JobFollowup, JobFollowupTemplate, JobNote, JobOperationLog, MatchingInventory, Merchi, MerchiFile, Notification, Payment, PaymentDevice, PhoneNumber, Product, ProductReview, ProductionComment, Quote, QuoteItem, Reminder, RequestOptions, apiFetch, apiFetchWithProgress, Session, Shipment, ShipmentLog, ShipmentItem, ShipmentItemFulfillment, ShipmentMethod, ShipmentMethodVariation, ShortUrl, SubscriptionPlan, SupplyDomain, SystemRole, Theme, ThemeCssSetting, User, UserCompany, Variation, VariationField, VariationFieldsOption, VariationOption, VariationsGroup, generateUUID, getCookie };
|
package/package.json
CHANGED
|
@@ -5,3 +5,24 @@ test('can make Variation', () => {
|
|
|
5
5
|
const variation = new merchi.Variation();
|
|
6
6
|
expect(variation).toBeTruthy();
|
|
7
7
|
});
|
|
8
|
+
|
|
9
|
+
test('textStyle keeps the designer text box from the server', () => {
|
|
10
|
+
const merchi = new Merchi();
|
|
11
|
+
const variation = new merchi.Variation();
|
|
12
|
+
const textStyle = {
|
|
13
|
+
colour: '#112233',
|
|
14
|
+
textSize: 56,
|
|
15
|
+
font: 'Oswald',
|
|
16
|
+
align: 'center',
|
|
17
|
+
x: 12.5,
|
|
18
|
+
y: 40,
|
|
19
|
+
width: 180,
|
|
20
|
+
height: 48,
|
|
21
|
+
rotation: 0,
|
|
22
|
+
scaleX: 1,
|
|
23
|
+
scaleY: 1,
|
|
24
|
+
};
|
|
25
|
+
variation.fromJson({ textStyle });
|
|
26
|
+
expect(variation.textStyle).toEqual(textStyle);
|
|
27
|
+
expect(variation.toJson().textStyle).toEqual(textStyle);
|
|
28
|
+
});
|
|
@@ -6,6 +6,27 @@ import { VariationField } from './variation_field.js';
|
|
|
6
6
|
import { VariationOption } from './variation_option.js';
|
|
7
7
|
import { VariationsGroup } from './variations_group.js';
|
|
8
8
|
|
|
9
|
+
/** Appearance of a text box the customer added in the designer. */
|
|
10
|
+
export interface DesignerTextStyle {
|
|
11
|
+
colour?: string;
|
|
12
|
+
textSize?: number;
|
|
13
|
+
font?: string;
|
|
14
|
+
align?: string;
|
|
15
|
+
x?: number;
|
|
16
|
+
y?: number;
|
|
17
|
+
width?: number;
|
|
18
|
+
height?: number;
|
|
19
|
+
rotation?: number;
|
|
20
|
+
scaleX?: number;
|
|
21
|
+
scaleY?: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Runtime type tag only. The API returns `textStyle` as JSON; the entity
|
|
26
|
+
* layer refuses `Object` from decorator metadata.
|
|
27
|
+
*/
|
|
28
|
+
const textStylePropertyType = class {};
|
|
29
|
+
|
|
9
30
|
export class Variation extends Entity {
|
|
10
31
|
protected static resourceName = 'variations';
|
|
11
32
|
protected static singularName = 'variation';
|
|
@@ -20,6 +41,11 @@ export class Variation extends Entity {
|
|
|
20
41
|
@Variation.property({type: String})
|
|
21
42
|
public value?: string | null;
|
|
22
43
|
|
|
44
|
+
// Catalog variations leave this empty. Set for a text box added in the
|
|
45
|
+
// designer: colour, size, font, alignment, and placement.
|
|
46
|
+
@Variation.property({type: textStylePropertyType})
|
|
47
|
+
public textStyle?: DesignerTextStyle | null;
|
|
48
|
+
|
|
23
49
|
@Variation.property()
|
|
24
50
|
public currency?: string;
|
|
25
51
|
|
package/src/index.ts
CHANGED
|
@@ -103,6 +103,8 @@ import * as util from './util/index.js';
|
|
|
103
103
|
import * as pricing from './pricing/index.js';
|
|
104
104
|
import { toastNotifications } from './toasts.js';
|
|
105
105
|
|
|
106
|
+
export type { DesignerTextStyle } from './entities/variation.js';
|
|
107
|
+
|
|
106
108
|
export {
|
|
107
109
|
constants,
|
|
108
110
|
request,
|