rerobe-js-orm 2.9.7 → 2.9.8

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.
@@ -1,6 +1,5 @@
1
1
  import OrderFactory from './OrderFactory';
2
2
  import OrderFormState from '../../form-states/Order/OrderFormState';
3
3
  export default class OrderFromFormState extends OrderFactory {
4
- getCustomerNameFromOrderFormState(fs: OrderFormState): string;
5
4
  createOrder(fs: OrderFormState): ReRobeOrderObj;
6
5
  }
@@ -4,44 +4,25 @@ const OrderFactory_1 = require("./OrderFactory");
4
4
  const Order_1 = require("../../models/Order");
5
5
  const order_constants_1 = require("../../constants/order-constants");
6
6
  class OrderFromFormState extends OrderFactory_1.default {
7
- getCustomerNameFromOrderFormState(fs) {
8
- var _a, _b;
9
- const customer = fs.fields.customer.selectedValue || {};
10
- const firstName = fs.fields.firstName.inputValue;
11
- const lastName = fs.fields.lastName.inputValue;
12
- if ((_a = fs.props) === null || _a === void 0 ? void 0 : _a.customerName) {
13
- return (_b = fs.props) === null || _b === void 0 ? void 0 : _b.customerName;
14
- }
15
- if (customer.displayName) {
16
- return customer.displayName;
17
- }
18
- if (customer.firstName || customer.lastName) {
19
- return `${customer.firstName} ${customer.lastName}`.trim();
20
- }
21
- if (firstName || lastName) {
22
- return `${firstName} ${lastName}`.trim();
23
- }
24
- return '';
25
- }
26
7
  createOrder(fs) {
27
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
8
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
28
9
  const currencyCode = fs.fields.currencyCode.inputValue || 'SEK';
29
10
  const customer = fs.fields.customer.selectedValue || {};
30
11
  const customerAttr = {
31
12
  userId: (customer === null || customer === void 0 ? void 0 : customer.uid) || '',
32
- customerName: this.getCustomerNameFromOrderFormState(fs),
33
- email: (customer === null || customer === void 0 ? void 0 : customer.email) || fs.fields.email.inputValue || '',
34
- phone: (customer === null || customer === void 0 ? void 0 : customer.phone) || fs.fields.phone.inputValue || '',
35
- customerUrl: ((_a = fs.props) === null || _a === void 0 ? void 0 : _a.customerUrl) || '',
13
+ customerName: ((_a = fs.props) === null || _a === void 0 ? void 0 : _a.customerName) || `${fs.fields.firstName.inputValue} ${fs.fields.lastName.inputValue}`.trim(),
14
+ email: fs.fields.email.inputValue || '',
15
+ phone: fs.fields.phone.inputValue || '',
16
+ customerUrl: ((_b = fs.props) === null || _b === void 0 ? void 0 : _b.customerUrl) || '',
36
17
  };
37
18
  const discountsAttr = {
38
19
  appliedDiscount: {
39
- amount: ((_b = fs.fields) === null || _b === void 0 ? void 0 : _b.totalDiscount.inputValue) || 0,
40
- value: ((_c = fs.fields) === null || _c === void 0 ? void 0 : _c.totalDiscount.inputValue) || 0,
41
- title: ((_d = fs.fields) === null || _d === void 0 ? void 0 : _d.discountTitle.inputValue) || '',
20
+ amount: ((_c = fs.fields) === null || _c === void 0 ? void 0 : _c.totalDiscount.inputValue) || 0,
21
+ value: ((_d = fs.fields) === null || _d === void 0 ? void 0 : _d.totalDiscount.inputValue) || 0,
22
+ title: fs.fields.presentmentData.selectedValue.discountTitlePresentment || ((_e = fs.fields) === null || _e === void 0 ? void 0 : _e.discountTitle.inputValue) || '',
42
23
  valueType: 'FIXED_AMOUNT',
43
24
  },
44
- discountApplications: ((_e = fs.props) === null || _e === void 0 ? void 0 : _e.discountApplications) || [],
25
+ discountApplications: ((_f = fs.props) === null || _f === void 0 ? void 0 : _f.discountApplications) || [],
45
26
  creditDiscount: { amount: fs.fields.creditDiscount.inputValue || 0, currencyCode },
46
27
  saleDiscount: { amount: fs.fields.saleDiscount.inputValue || 0, currencyCode },
47
28
  additionalDiscount: { amount: fs.fields.additionalDiscount.inputValue || 0, currencyCode },
@@ -57,11 +38,11 @@ class OrderFromFormState extends OrderFactory_1.default {
57
38
  zip: '',
58
39
  };
59
40
  const shippingAndLocationAttr = {
60
- fulfillmentLocations: ((_f = fs.fields.shippingInfo.selectedValue) === null || _f === void 0 ? void 0 : _f.productsLocationsMapping) || [],
41
+ fulfillmentLocations: ((_g = fs.fields.shippingInfo.selectedValue) === null || _g === void 0 ? void 0 : _g.productsLocationsMapping) || [],
61
42
  shippingAddress: fs.fields.shippingType.selectedValue === order_constants_1.SHIPPING_TYPES.localPickUp
62
43
  ? initShippingAddress
63
44
  : fs.fields.shippingAddress.selectedValue || initShippingAddress,
64
- shippingDiscountAllocations: ((_g = fs.props) === null || _g === void 0 ? void 0 : _g.shippingDiscountAllocations) || [],
45
+ shippingDiscountAllocations: ((_h = fs.props) === null || _h === void 0 ? void 0 : _h.shippingDiscountAllocations) || [],
65
46
  shippingLine: fs.fields.shippingLine
66
47
  ? fs.fields.shippingLine.selectedValue
67
48
  : {
@@ -90,12 +71,12 @@ class OrderFromFormState extends OrderFactory_1.default {
90
71
  },
91
72
  };
92
73
  const presentmentTotalPricesAttr = {
93
- subtotalPricePresentment: fs.props.subtotalPricePresentment,
94
- totalDiscountPresentment: fs.props.totalDiscountPresentment,
95
- totalPricePresentment: fs.props.totalPricePresentment,
96
- totalRefundedPresentment: fs.props.totalRefundedPresentment,
97
- totalShippingPricePresentment: fs.props.totalShippingPricePresentment,
98
- totalTaxPresentment: fs.props.totalTaxPresentment,
74
+ subtotalPricePresentment: fs.fields.presentmentData.selectedValue.subtotalPricePresentment,
75
+ totalDiscountPresentment: fs.fields.presentmentData.selectedValue.totalDiscountPresentment,
76
+ totalPricePresentment: fs.fields.presentmentData.selectedValue.totalPricePresentment,
77
+ totalRefundedPresentment: fs.fields.presentmentData.selectedValue.totalRefundedPresentment,
78
+ totalShippingPricePresentment: fs.fields.presentmentData.selectedValue.totalShippingPricePresentment,
79
+ totalTaxPresentment: fs.fields.presentmentData.selectedValue.totalTaxPresentment,
99
80
  };
100
81
  const totalPricesAttr = {
101
82
  subtotalPrice: { amount: fs.fields.subtotalPrice.inputValue || 0, currencyCode },
@@ -109,12 +90,12 @@ class OrderFromFormState extends OrderFactory_1.default {
109
90
  originalTotalPrice: { amount: fs.fields.originalTotalPrice.inputValue || 0, currencyCode },
110
91
  };
111
92
  const statusesAttr = {
112
- state: ((_h = fs.props) === null || _h === void 0 ? void 0 : _h.state) || Order_1.default.ORDER_STATES.draft,
93
+ state: ((_j = fs.props) === null || _j === void 0 ? void 0 : _j.state) || Order_1.default.ORDER_STATES.draft,
113
94
  financialStatus: fs.fields.financialStatus.selectedValue,
114
95
  fulfillmentStatus: fs.fields.fulfillmentStatus.selectedValue,
115
- statusUrl: ((_j = fs.props) === null || _j === void 0 ? void 0 : _j.statusUrl) || '',
96
+ statusUrl: ((_k = fs.props) === null || _k === void 0 ? void 0 : _k.statusUrl) || '',
116
97
  };
117
- const orderAttributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, totalPricesAttr), presentmentTotalPricesAttr), discountsAttr), shippingAndLocationAttr), customerAttr), statusesAttr), { id: ((_k = fs.props) === null || _k === void 0 ? void 0 : _k.id) || '', documentId: ((_l = fs.props) === null || _l === void 0 ? void 0 : _l.documentId) || '', name: ((_m = fs.props) === null || _m === void 0 ? void 0 : _m.name) || '', orderNumber: (_o = fs.props) === null || _o === void 0 ? void 0 : _o.orderNumber, ribbnOrderNumber: (_p = fs.props) === null || _p === void 0 ? void 0 : _p.ribbnOrderNumber, merchantId: ((_q = fs.props) === null || _q === void 0 ? void 0 : _q.merchantId) || '', currencyCode: fs.fields.currencyCode.inputValue, lineItems: fs.fields.lineItems.selectedValues || [], fulfillments: ((_r = fs.props) === null || _r === void 0 ? void 0 : _r.fulfillments) || [], refunds: ((_s = fs.props) === null || _s === void 0 ? void 0 : _s.refunds) || [], paymentType: fs.fields.paymentType.selectedValue, paymentMethod: fs.fields.paymentMethod.selectedValue || '', paymentDetails: fs.fields.paymentDetails.selectedValue || {}, notes: fs.fields.notes.inputValue || '', tags: fs.fields.tags.selectedValues || [], cancelReason: fs.fields.cancelReason.selectedValue || '', canceledAt: ((_t = fs.props) === null || _t === void 0 ? void 0 : _t.canceledAt) || '', processedAt: ((_u = fs.props) === null || _u === void 0 ? void 0 : _u.processedAt) || new Date().toUTCString(), createdAtTimestamp: 0, updatedAtTimestamp: 0 });
98
+ const orderAttributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, totalPricesAttr), presentmentTotalPricesAttr), discountsAttr), shippingAndLocationAttr), customerAttr), statusesAttr), { id: ((_l = fs.props) === null || _l === void 0 ? void 0 : _l.id) || '', documentId: ((_m = fs.props) === null || _m === void 0 ? void 0 : _m.documentId) || '', name: ((_o = fs.props) === null || _o === void 0 ? void 0 : _o.name) || '', orderNumber: (_p = fs.props) === null || _p === void 0 ? void 0 : _p.orderNumber, ribbnOrderNumber: (_q = fs.props) === null || _q === void 0 ? void 0 : _q.ribbnOrderNumber, merchantId: ((_r = fs.props) === null || _r === void 0 ? void 0 : _r.merchantId) || '', currencyCode: fs.fields.currencyCode.inputValue, lineItems: fs.fields.lineItems.selectedValues || [], fulfillments: ((_s = fs.props) === null || _s === void 0 ? void 0 : _s.fulfillments) || [], refunds: ((_t = fs.props) === null || _t === void 0 ? void 0 : _t.refunds) || [], paymentType: fs.fields.paymentType.selectedValue, paymentMethod: fs.fields.paymentMethod.selectedValue || '', paymentDetails: fs.fields.paymentDetails.selectedValue || {}, notes: fs.fields.notes.inputValue || '', tags: fs.fields.tags.selectedValues || [], cancelReason: fs.fields.cancelReason.selectedValue || '', canceledAt: ((_u = fs.props) === null || _u === void 0 ? void 0 : _u.canceledAt) || '', processedAt: ((_v = fs.props) === null || _v === void 0 ? void 0 : _v.processedAt) || new Date().toUTCString(), createdAtTimestamp: 0, updatedAtTimestamp: 0 });
118
99
  return new Order_1.default(Object.assign({}, orderAttributes));
119
100
  }
120
101
  }
@@ -9,10 +9,7 @@ export default abstract class FormState extends Base {
9
9
  onAddNewOptionToFormFieldOptions(key: keyof FormStateObject, option: FormFieldOption): void;
10
10
  onSetNewFormFieldOptions(key: keyof FormStateObject, options: FormFieldOption[]): void;
11
11
  editExistingOption(key: keyof FormStateObject, oldOptionValue: string, option: FormFieldOption): void;
12
- setTextInputFormStateFields(formStateSlice: {
13
- [key: string]: string | number | null;
14
- }): void;
15
- setSingleSelectFormStateFields(formStateSlice: {
12
+ setFormStateFields(formStateSlice: {
16
13
  [key: string]: any;
17
14
  }): void;
18
15
  }
@@ -50,16 +50,18 @@ class FormState extends Base_1.default {
50
50
  formField.options[existingOptionIndex] = option;
51
51
  }
52
52
  }
53
- setTextInputFormStateFields(formStateSlice) {
53
+ setFormStateFields(formStateSlice) {
54
54
  Object.keys(formStateSlice).forEach((key) => {
55
55
  const field = this.fields[key];
56
- field.inputValue = formStateSlice[key] || '';
57
- });
58
- }
59
- setSingleSelectFormStateFields(formStateSlice) {
60
- Object.keys(formStateSlice).forEach((key) => {
61
- const field = this.fields[key];
62
- field.selectedValue = formStateSlice[key] || '';
56
+ if (field && Object.keys(field).includes('inputValue')) {
57
+ field.inputValue = formStateSlice[key] || '';
58
+ }
59
+ if (field && Object.keys(field).includes('selectedValue')) {
60
+ field.selectedValue = formStateSlice[key] || {};
61
+ }
62
+ if (field && Object.keys(field).includes('selectedValues')) {
63
+ field.selectedValues = formStateSlice[key] || [];
64
+ }
63
65
  });
64
66
  }
65
67
  }
@@ -6,6 +6,8 @@ export default class OrderFormState extends FormState {
6
6
  props: CompleteOrder;
7
7
  opts: {
8
8
  tagOptions: string[];
9
+ shippingTypeOptions: FormFieldOption[];
10
+ pickupLocationOptions: FormFieldOption[];
9
11
  };
10
12
  orderHelpers: OrderHelpers;
11
13
  constructor(props?: any, opts?: any);
@@ -16,5 +18,6 @@ export default class OrderFormState extends FormState {
16
18
  }): void;
17
19
  discountChangeHandler(val: string): void;
18
20
  shippingPriceChangeHandler(val: string): void;
21
+ customerChangeHandler(customer: UserAttributes): void;
19
22
  private fieldFactory;
20
23
  }
@@ -5,6 +5,7 @@ const Order_1 = require("../../models/Order");
5
5
  const OrderFromFormState_1 = require("../../factories/Order/OrderFromFormState");
6
6
  const OrderHelpers_1 = require("../../helpers/OrderHelpers");
7
7
  const options_1 = require("./options");
8
+ const order_constants_1 = require("../../constants/order-constants");
8
9
  class OrderFormState extends FormState_1.default {
9
10
  constructor(props, opts) {
10
11
  super();
@@ -45,6 +46,7 @@ class OrderFormState extends FormState_1.default {
45
46
  this.fields.additionalDiscount = this.fieldFactory('textInput', 'additionalDiscount');
46
47
  this.fields.shippingInfo = this.fieldFactory('singleSelect', 'shippingInfo');
47
48
  this.fields.pickupLocation = this.fieldFactory('singleSelect', 'pickupLocation');
49
+ this.fields.presentmentData = this.fieldFactory('singleSelect', 'presentmentData');
48
50
  }
49
51
  createOrder() {
50
52
  const orderFactory = new OrderFromFormState_1.default();
@@ -95,7 +97,15 @@ class OrderFormState extends FormState_1.default {
95
97
  // Update total price
96
98
  this.fields.totalPrice.inputValue = Number(Number(this.fields.subtotalPrice.inputValue) - Number(this.fields.totalDiscount.inputValue) + Number(val)).toFixed(2);
97
99
  }
100
+ customerChangeHandler(customer) {
101
+ this.fields.customer.selectedValue = customer;
102
+ this.fields.email.inputValue = (customer === null || customer === void 0 ? void 0 : customer.email) || '';
103
+ this.fields.phone.inputValue = (customer === null || customer === void 0 ? void 0 : customer.phone) || '';
104
+ this.fields.firstName.inputValue = (customer === null || customer === void 0 ? void 0 : customer.displayName) || (customer === null || customer === void 0 ? void 0 : customer.firstName) || '';
105
+ this.fields.lastName.inputValue = !(customer === null || customer === void 0 ? void 0 : customer.displayName) && (customer === null || customer === void 0 ? void 0 : customer.lastName) ? customer === null || customer === void 0 ? void 0 : customer.lastName : '';
106
+ }
98
107
  fieldFactory(fieldType, fieldKey, fieldOptions) {
108
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
99
109
  let options = fieldOptions || [];
100
110
  const hidden = false;
101
111
  if (fieldType === 'textInput') {
@@ -116,7 +126,8 @@ class OrderFormState extends FormState_1.default {
116
126
  fieldKey === 'creditDiscount' ||
117
127
  fieldKey === 'saleDiscount' ||
118
128
  fieldKey === 'additionalDiscount' ||
119
- fieldKey === 'subTotalWithShipping') {
129
+ fieldKey === 'subTotalWithShipping' ||
130
+ fieldKey === 'subTotalWithSalePriceIncluded') {
120
131
  // @ts-ignore
121
132
  inputValue = this.props[fieldKey] ? this.props[fieldKey].amount : 0;
122
133
  }
@@ -136,15 +147,54 @@ class OrderFormState extends FormState_1.default {
136
147
  }
137
148
  if (fieldType === 'singleSelect') {
138
149
  let selectedValue = this.props[fieldKey] || '';
150
+ if (fieldKey === 'pickupLocation') {
151
+ if (((_a = this.props) === null || _a === void 0 ? void 0 : _a.shippingType) === order_constants_1.SHIPPING_TYPES.localPickUp) {
152
+ selectedValue =
153
+ ((_b = this.props) === null || _b === void 0 ? void 0 : _b.fulfillmentLocations) && ((_c = this.props.fulfillmentLocations[0]) === null || _c === void 0 ? void 0 : _c.location)
154
+ ? this.props.fulfillmentLocations[0].location.locationId ||
155
+ this.props.fulfillmentLocations[0].location.documentId ||
156
+ ''
157
+ : '';
158
+ }
159
+ if ((_e = (_d = this.opts) === null || _d === void 0 ? void 0 : _d.pickupLocationOptions) === null || _e === void 0 ? void 0 : _e.length) {
160
+ options = this.utilities.uniqObjArray(this.opts.pickupLocationOptions, 'value');
161
+ }
162
+ }
163
+ if (fieldKey === 'shippingInfo') {
164
+ selectedValue = {
165
+ productsLocationsMapping: ((_f = this.props) === null || _f === void 0 ? void 0 : _f.fulfillmentLocations) || [],
166
+ description: '',
167
+ price: ((_h = (_g = this.props) === null || _g === void 0 ? void 0 : _g.totalShippingPrice) === null || _h === void 0 ? void 0 : _h.amount) || 0,
168
+ disabled: false,
169
+ };
170
+ }
171
+ if (fieldKey === 'presentmentData') {
172
+ selectedValue = {
173
+ presentmentCurrencyCode: ((_k = (_j = this.props) === null || _j === void 0 ? void 0 : _j.totalPricePresentment) === null || _k === void 0 ? void 0 : _k.currencyCode) || '',
174
+ discountTitlePresentment: ((_m = (_l = this.props) === null || _l === void 0 ? void 0 : _l.appliedDiscount) === null || _m === void 0 ? void 0 : _m.title) || '',
175
+ subtotalPricePresentment: ((_o = this.props) === null || _o === void 0 ? void 0 : _o.subtotalPricePresentment) || { amount: 0 },
176
+ totalDiscountPresentment: ((_p = this.props) === null || _p === void 0 ? void 0 : _p.totalDiscountPresentment) || { amount: 0 },
177
+ totalShippingPricePresentment: ((_q = this.props) === null || _q === void 0 ? void 0 : _q.totalShippingPricePresentment) || { amount: 0 },
178
+ totalPricePresentment: ((_r = this.props) === null || _r === void 0 ? void 0 : _r.totalPricePresentment) || { amount: 0 },
179
+ totalRefundedPresentment: ((_s = this.props) === null || _s === void 0 ? void 0 : _s.totalRefundedPresentment) || { amount: 0 },
180
+ totalTaxPresentment: ((_t = this.props) === null || _t === void 0 ? void 0 : _t.totalTaxPresentment) || { amount: 0 },
181
+ };
182
+ }
183
+ const valid = !!this.props[fieldKey];
184
+ let onChangeHandler = (val) => this.singleSelectChangeHandler(fieldKey, val);
139
185
  if (fieldKey === 'customer') {
140
186
  selectedValue = {
141
187
  uid: this.props.userId,
142
188
  email: this.props.email,
143
189
  displayName: this.props.customerName,
144
190
  };
191
+ onChangeHandler = (val) => this.customerChangeHandler(val);
192
+ }
193
+ if (fieldKey === 'shippingType') {
194
+ if ((_v = (_u = this.opts) === null || _u === void 0 ? void 0 : _u.shippingTypeOptions) === null || _v === void 0 ? void 0 : _v.length) {
195
+ options = this.utilities.uniqObjArray(this.opts.shippingTypeOptions, 'value');
196
+ }
145
197
  }
146
- const valid = !!this.props[fieldKey];
147
- const onChangeHandler = (val) => this.singleSelectChangeHandler(fieldKey, val);
148
198
  return {
149
199
  options,
150
200
  hidden,
@@ -85,7 +85,7 @@ class OrderHelpers {
85
85
  shopifyProductId: product.shopifyId || null,
86
86
  productId: product.documentId,
87
87
  status: product.status || '',
88
- isOnSale: product.isOnSale && product.clearanceTimestamp ? 'yes' : '',
88
+ isOnSale: product.isOnSale === 'yes' && product.clearanceTimestamp ? 'yes' : '',
89
89
  salePrice: product.salePrice || '',
90
90
  };
91
91
  }
@@ -74,4 +74,5 @@ declare type WebhookFormFields = {
74
74
  interface LocationInput extends AddressInput {
75
75
  name?: string;
76
76
  locationId?: string;
77
+ documentId?: string;
77
78
  }
@@ -229,6 +229,9 @@ interface ReRobeOrderLineItem extends OrderLineItem {
229
229
  status?: ProductSellStatusKeys | string;
230
230
  isOnSale?: string;
231
231
  salePrice?: string;
232
+ presentmentTotalPrice?: Money;
233
+ presentmentUnitPrice?: Money;
234
+ presentmentSalePrice?: Money;
232
235
  }
233
236
  declare type OrderLineItemConnection = {
234
237
  edges: OrderLineItemEdge[];
@@ -664,6 +667,16 @@ declare type OrderShippingInfo = {
664
667
  disabled: boolean;
665
668
  productsLocationsMapping: ProductLocationMapping[];
666
669
  };
670
+ declare type OrderPresentmentData = {
671
+ presentmentCurrencyCode?: string;
672
+ discountTitlePresentment?: string;
673
+ subtotalPricePresentment: Money;
674
+ totalDiscountPresentment: Money;
675
+ totalShippingPricePresentment: Money;
676
+ totalPricePresentment: Money;
677
+ totalRefundedPresentment?: Money;
678
+ totalTaxPresentment?: Money;
679
+ };
667
680
  declare type CompleteOrder = ReRobeOrderObj & {
668
681
  [key: string]: any;
669
682
  };
@@ -711,6 +724,7 @@ declare type OrderAttributesFormFields = {
711
724
  additionalDiscount: TextInputFormField<string | number>;
712
725
  shippingInfo: SingleSelectFormField<OrderShippingInfo>;
713
726
  pickupLocation: SingleSelectFormField<string>;
727
+ presentmentData: SingleSelectFormField<OrderPresentmentData>;
714
728
  };
715
729
  declare type OrderRefundFormFields = {
716
730
  totalRefunded: TextInputFormField<string | number>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.9.7",
3
+ "version": "2.9.8",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",