@peabody-soft/mbs-model-ts 1.4.0 → 1.5.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/CartEditor.d.ts +10 -5
- package/dist/CartEditor.js +232 -125
- package/dist/Catalog.js +26 -18
- package/dist/Enums.d.ts +1 -1
- package/dist/Enums.js +2 -1
- package/dist/GeneralSettings.d.ts +4 -2
- package/dist/GeneralSettings.js +18 -7
- package/dist/Ids.d.ts +2 -0
- package/dist/Ids.js +10 -0
- package/dist/Message.js +3 -2
- package/dist/Model.d.ts +5 -0
- package/dist/Model.js +263 -50
- package/dist/Package.js +2 -2
- package/dist/Price.js +6 -2
- package/dist/Product.d.ts +5 -3
- package/dist/Product.js +30 -18
- package/dist/Profile.d.ts +1 -0
- package/dist/Profile.js +91 -4
- package/dist/ProtoMap.d.ts +15 -8
- package/dist/ProtoMap.js +265 -139
- package/dist/ShoppingList.d.ts +30 -1
- package/dist/ShoppingList.js +345 -35
- package/dist/SyncCache.d.ts +9 -0
- package/dist/SyncCache.js +93 -30
- package/dist/SyncState.js +1 -1
- package/dist/Tax.d.ts +12 -4
- package/dist/Tax.js +33 -4
- package/dist/TaxHelper.d.ts +12 -0
- package/dist/TaxHelper.js +93 -0
- package/dist/TaxType.d.ts +7 -0
- package/dist/TaxType.js +32 -0
- package/dist/generated/AttachmentType.d.ts +19 -1
- package/dist/generated/AttachmentType.js +18 -0
- package/dist/generated/AuthTokens.d.ts +3 -1
- package/dist/generated/BusinessLink.d.ts +4 -1
- package/dist/generated/BusinessSyncInRequest.d.ts +11 -3
- package/dist/generated/BusinessSyncInResponse.d.ts +5 -4
- package/dist/generated/BusinessSyncOutRequest.d.ts +37 -10
- package/dist/generated/BusinessSyncOutRequest.js +42 -29
- package/dist/generated/BusinessSyncOutResponse.d.ts +14 -1
- package/dist/generated/Configuration.d.ts +2 -1
- package/dist/generated/CreateUserRequest.d.ts +8 -2
- package/dist/generated/Entity.d.ts +7 -3
- package/dist/generated/GeneralSettings.d.ts +14 -4
- package/dist/generated/GeneralSettings.js +9 -1
- package/dist/generated/Message.d.ts +4 -2
- package/dist/generated/Product.d.ts +10 -1
- package/dist/generated/Product.js +9 -1
- package/dist/generated/ProfileSyncOutRequest.d.ts +17 -1
- package/dist/generated/ProfileSyncOutResponse.d.ts +8 -3
- package/dist/generated/SalesOrderPayload.d.ts +7 -2
- package/dist/generated/ShoppingList.d.ts +6 -3
- package/dist/generated/ShoppingListItem.d.ts +21 -6
- package/dist/generated/Tax.d.ts +4 -4
- package/dist/generated/Tax.js +7 -8
- package/dist/generated/WorkingHoursRange.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/package.json +55 -55
- package/dist/generated/TaxType.d.ts +0 -25
- package/dist/generated/TaxType.js +0 -30
package/dist/Enums.d.ts
CHANGED
|
@@ -12,5 +12,5 @@ export { ProductType } from "./generated/ProductType";
|
|
|
12
12
|
export { ReservedPackage } from "./generated/ReservedPackage";
|
|
13
13
|
export { Role } from "./generated/Role";
|
|
14
14
|
export { TaskStatus } from "./generated/TaskStatus";
|
|
15
|
-
export { TaxType } from "./
|
|
15
|
+
export { TaxType } from "./TaxType";
|
|
16
16
|
export { WeightUnit } from "./generated/WeightUnit";
|
package/dist/Enums.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Every enum of the protocol, re-exported under its own name so their Java-defined numeric ids
|
|
2
2
|
// have only one place to be wrong, and this file records which enums are part of the library's surface.
|
|
3
|
+
// TaxType is the exception: the protocol does not carry it, so it is defined in TaxType.ts.
|
|
3
4
|
export { AddressType } from "./generated/AddressType";
|
|
4
5
|
export { AttachmentType } from "./generated/AttachmentType";
|
|
5
6
|
export { AuthenticationMethod } from "./generated/AuthenticationMethod";
|
|
@@ -14,5 +15,5 @@ export { ProductType } from "./generated/ProductType";
|
|
|
14
15
|
export { ReservedPackage } from "./generated/ReservedPackage";
|
|
15
16
|
export { Role } from "./generated/Role";
|
|
16
17
|
export { TaskStatus } from "./generated/TaskStatus";
|
|
17
|
-
export { TaxType } from "./
|
|
18
|
+
export { TaxType } from "./TaxType";
|
|
18
19
|
export { WeightUnit } from "./generated/WeightUnit";
|
|
@@ -23,8 +23,9 @@ export default class GeneralSettings {
|
|
|
23
23
|
private readonly _googleBusinessCategoryId;
|
|
24
24
|
private readonly _googleBusinessCategoryName;
|
|
25
25
|
private readonly _onlineStoreThemeId;
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
private readonly _onlineShoppingEnabled;
|
|
27
|
+
static fromScaledValues(paymentMethodDetails: ReadonlyArray<PaymentMethodDetail>, customerServicePhone: string | null, isWhatsAppSupported: boolean, isSmsSupported: boolean, businessAddresses: AddressList, businessIdentifiers: ReadonlyArray<BusinessIdentifier>, fulfillmentModes: ReadonlyArray<proto_FulfillmentMode>, scaledDeliveryCharge: bigint, deliveryChargeTaxes: ReadonlyArray<Tax>, scaledFreeDeliveryTotal: bigint, deliveryRadiusKilometres: number, storeTagline: string | null, workingDays: WorkingDays, primaryStoreLocation: LatLong | null, googleBusinessCategoryId: string | null, googleBusinessCategoryName: string | null, onlineStoreThemeId: string | null, onlineShoppingEnabled: boolean): GeneralSettings;
|
|
28
|
+
constructor(_paymentMethodDetails: ReadonlyArray<PaymentMethodDetail>, _customerServicePhone: string | null, _isWhatsAppSupported: boolean, _isSmsSupported: boolean, _businessAddresses: AddressList, _businessIdentifiers: ReadonlyArray<BusinessIdentifier>, _fulfillmentModes: ReadonlyArray<proto_FulfillmentMode>, _deliveryCharge: number, _deliveryChargeTaxes: ReadonlyArray<Tax>, _freeDeliveryTotal: number, _deliveryRadiusKilometres: number, _storeTagline: string | null, _workingDays: WorkingDays, _primaryStoreLocation: LatLong | null, _googleBusinessCategoryId: string | null, _googleBusinessCategoryName: string | null, _onlineStoreThemeId: string | null, _onlineShoppingEnabled: boolean);
|
|
28
29
|
get paymentMethodDetails(): ReadonlyArray<PaymentMethodDetail>;
|
|
29
30
|
get customerServicePhone(): string | null;
|
|
30
31
|
get isWhatsAppSupported(): boolean;
|
|
@@ -42,5 +43,6 @@ export default class GeneralSettings {
|
|
|
42
43
|
get googleBusinessCategoryId(): string | null;
|
|
43
44
|
get googleBusinessCategoryName(): string | null;
|
|
44
45
|
get onlineStoreThemeId(): string | null;
|
|
46
|
+
get onlineShoppingEnabled(): boolean;
|
|
45
47
|
static readonly EMPTY: GeneralSettings;
|
|
46
48
|
}
|
package/dist/GeneralSettings.js
CHANGED
|
@@ -7,10 +7,10 @@ import WorkingDays from "./WorkingDays";
|
|
|
7
7
|
class GeneralSettings {
|
|
8
8
|
// Only ProtoMap calls this: it is the one place that sees amounts still multiplied by
|
|
9
9
|
// Constants.AMOUNT_FACTOR.
|
|
10
|
-
static fromScaledValues(paymentMethodDetails, customerServicePhone, isWhatsAppSupported, isSmsSupported, businessAddresses, businessIdentifiers, fulfillmentModes, scaledDeliveryCharge, deliveryChargeTaxes, scaledFreeDeliveryTotal, deliveryRadiusKilometres, storeTagline, workingDays, primaryStoreLocation, googleBusinessCategoryId, googleBusinessCategoryName, onlineStoreThemeId) {
|
|
11
|
-
return new GeneralSettings(paymentMethodDetails, customerServicePhone, isWhatsAppSupported, isSmsSupported, businessAddresses, businessIdentifiers, fulfillmentModes, amountFromScaledValue(scaledDeliveryCharge), deliveryChargeTaxes, amountFromScaledValue(scaledFreeDeliveryTotal), deliveryRadiusKilometres, storeTagline, workingDays, primaryStoreLocation, googleBusinessCategoryId, googleBusinessCategoryName, onlineStoreThemeId);
|
|
10
|
+
static fromScaledValues(paymentMethodDetails, customerServicePhone, isWhatsAppSupported, isSmsSupported, businessAddresses, businessIdentifiers, fulfillmentModes, scaledDeliveryCharge, deliveryChargeTaxes, scaledFreeDeliveryTotal, deliveryRadiusKilometres, storeTagline, workingDays, primaryStoreLocation, googleBusinessCategoryId, googleBusinessCategoryName, onlineStoreThemeId, onlineShoppingEnabled) {
|
|
11
|
+
return new GeneralSettings(paymentMethodDetails, customerServicePhone, isWhatsAppSupported, isSmsSupported, businessAddresses, businessIdentifiers, fulfillmentModes, amountFromScaledValue(scaledDeliveryCharge), deliveryChargeTaxes, amountFromScaledValue(scaledFreeDeliveryTotal), deliveryRadiusKilometres, storeTagline, workingDays, primaryStoreLocation, googleBusinessCategoryId, googleBusinessCategoryName, onlineStoreThemeId, onlineShoppingEnabled);
|
|
12
12
|
}
|
|
13
|
-
constructor(_paymentMethodDetails, _customerServicePhone, _isWhatsAppSupported, _isSmsSupported, _businessAddresses, _businessIdentifiers, _fulfillmentModes, _deliveryCharge, _deliveryChargeTaxes, _freeDeliveryTotal, _deliveryRadiusKilometres, _storeTagline, _workingDays, _primaryStoreLocation, _googleBusinessCategoryId, _googleBusinessCategoryName, _onlineStoreThemeId) {
|
|
13
|
+
constructor(_paymentMethodDetails, _customerServicePhone, _isWhatsAppSupported, _isSmsSupported, _businessAddresses, _businessIdentifiers, _fulfillmentModes, _deliveryCharge, _deliveryChargeTaxes, _freeDeliveryTotal, _deliveryRadiusKilometres, _storeTagline, _workingDays, _primaryStoreLocation, _googleBusinessCategoryId, _googleBusinessCategoryName, _onlineStoreThemeId, _onlineShoppingEnabled) {
|
|
14
14
|
this._paymentMethodDetails = _paymentMethodDetails;
|
|
15
15
|
this._customerServicePhone = _customerServicePhone;
|
|
16
16
|
this._isWhatsAppSupported = _isWhatsAppSupported;
|
|
@@ -28,6 +28,7 @@ class GeneralSettings {
|
|
|
28
28
|
this._googleBusinessCategoryId = _googleBusinessCategoryId;
|
|
29
29
|
this._googleBusinessCategoryName = _googleBusinessCategoryName;
|
|
30
30
|
this._onlineStoreThemeId = _onlineStoreThemeId;
|
|
31
|
+
this._onlineShoppingEnabled = _onlineShoppingEnabled;
|
|
31
32
|
}
|
|
32
33
|
get paymentMethodDetails() {
|
|
33
34
|
return this._paymentMethodDetails;
|
|
@@ -52,15 +53,18 @@ class GeneralSettings {
|
|
|
52
53
|
get fulfillmentModes() {
|
|
53
54
|
return this._fulfillmentModes;
|
|
54
55
|
}
|
|
56
|
+
// What delivery costs, INCLUDING the taxes in deliveryChargeTaxes, as the price of a package
|
|
57
|
+
// includes the taxes of its product. CartEditor takes them out when it puts the charge in a list.
|
|
55
58
|
get deliveryCharge() {
|
|
56
59
|
return this._deliveryCharge;
|
|
57
60
|
}
|
|
58
|
-
// The taxes
|
|
59
|
-
// Constants.MAX_TAXES of them. Empty means the charge
|
|
61
|
+
// The taxes included in the delivery charge, which are the business's own and not a product's -
|
|
62
|
+
// at most Constants.MAX_TAXES of them. Empty means the charge includes no tax.
|
|
60
63
|
get deliveryChargeTaxes() {
|
|
61
64
|
return this._deliveryChargeTaxes;
|
|
62
65
|
}
|
|
63
|
-
// Order total at or above which delivery is free
|
|
66
|
+
// Order total at or above which delivery is free, measured on the goods with their taxes in
|
|
67
|
+
// them and without the delivery charge. Zero means never free, not always free.
|
|
64
68
|
get freeDeliveryTotal() {
|
|
65
69
|
return this._freeDeliveryTotal;
|
|
66
70
|
}
|
|
@@ -93,7 +97,14 @@ class GeneralSettings {
|
|
|
93
97
|
get onlineStoreThemeId() {
|
|
94
98
|
return this._onlineStoreThemeId;
|
|
95
99
|
}
|
|
100
|
+
// Whether the business has turned online shopping on. The server does not refuse a business that has not: Model does,
|
|
101
|
+
// with a NotFoundException, once it has read everything it is sent and finds that the settings it then holds do not
|
|
102
|
+
// say so, or that it holds none - see Model.setBusinessId. Also false of a business that has made no settings, which
|
|
103
|
+
// is what GeneralSettings.EMPTY is.
|
|
104
|
+
get onlineShoppingEnabled() {
|
|
105
|
+
return this._onlineShoppingEnabled;
|
|
106
|
+
}
|
|
96
107
|
}
|
|
97
108
|
// A business with no published public settings, used instead of null so every field is already the protocol's empty value.
|
|
98
|
-
GeneralSettings.EMPTY = new GeneralSettings(Object.freeze([]), null, false, false, AddressList.EMPTY, Object.freeze([]), Object.freeze([]), 0, Object.freeze([]), 0, 0, null, WorkingDays.ALL_DAYS, null, null, null, null);
|
|
109
|
+
GeneralSettings.EMPTY = new GeneralSettings(Object.freeze([]), null, false, false, AddressList.EMPTY, Object.freeze([]), Object.freeze([]), 0, Object.freeze([]), 0, 0, null, WorkingDays.ALL_DAYS, null, null, null, null, false);
|
|
99
110
|
export default GeneralSettings;
|
package/dist/Ids.d.ts
CHANGED
|
@@ -7,11 +7,13 @@ export default class Ids {
|
|
|
7
7
|
static isReservedPackageId(packageId: bigint): boolean;
|
|
8
8
|
static toStorageHexString(id: bigint): string;
|
|
9
9
|
static toOrderNumberString(orderId: bigint): string;
|
|
10
|
+
static getSyncCursorBlobId(key: number): bigint;
|
|
10
11
|
static readonly ENTITY_TYPE_BIT_SHIFT: bigint;
|
|
11
12
|
static readonly ID_MASK: bigint;
|
|
12
13
|
static readonly GENERAL_SETTINGS_CONFIGURATION_ID: bigint;
|
|
13
14
|
static readonly ATTACHMENT_BASE_URL_BLOB_ID: bigint;
|
|
14
15
|
static readonly AUTH_TOKENS_BLOB_ID: bigint;
|
|
16
|
+
private static readonly SYNC_CURSOR_BLOB_ID_BASE;
|
|
15
17
|
private static readonly UNSIGNED_64_BIT_MASK;
|
|
16
18
|
private static readonly UNSIGNED_32_BIT_MASK;
|
|
17
19
|
}
|
package/dist/Ids.js
CHANGED
|
@@ -61,6 +61,14 @@ class Ids {
|
|
|
61
61
|
static toOrderNumberString(orderId) {
|
|
62
62
|
return (orderId & Ids.UNSIGNED_32_BIT_MASK).toString(16).toUpperCase();
|
|
63
63
|
}
|
|
64
|
+
// Where a container keeps how far its reads of one entity type have got: the cursor the next read
|
|
65
|
+
// sends for it, which is the eTag of the blob and the whole of it. The store keeps the greater of two
|
|
66
|
+
// eTags, so a cursor is never lowered, by a page that is stale or sent again or by another tab
|
|
67
|
+
// writing at the same time. Written in the batch of the page that moved it, so that it cannot get
|
|
68
|
+
// ahead of the entities it describes. key is one of SyncKeys: the table an entity type counts under.
|
|
69
|
+
static getSyncCursorBlobId(key) {
|
|
70
|
+
return Ids.SYNC_CURSOR_BLOB_ID_BASE - BigInt(key);
|
|
71
|
+
}
|
|
64
72
|
}
|
|
65
73
|
Ids.ENTITY_TYPE_BIT_SHIFT = BigInt(proto_Constants.ENTITY_TYPE_BIT_SHIFT);
|
|
66
74
|
// Everything an id holds below its entity type; not in Constants.proto since 64 bits don't fit an enum value.
|
|
@@ -73,6 +81,8 @@ Ids.GENERAL_SETTINGS_CONFIGURATION_ID = 0x0d10000000000000n;
|
|
|
73
81
|
Ids.ATTACHMENT_BASE_URL_BLOB_ID = -1n;
|
|
74
82
|
// Where a container keeps the credentials that sign its calls - see AuthTokens. Written with a null eTag, since a reissued token is not a later version of an earlier one: the latest simply wins.
|
|
75
83
|
Ids.AUTH_TOKENS_BLOB_ID = -2n;
|
|
84
|
+
// The first of a block of fixed blob ids, one per key - see getSyncCursorBlobId. A key is an entity type id, which is below 0x80, so the block runs from -0x100 down to -0x17F and cannot meet the other fixed blobs at -1 and -2.
|
|
85
|
+
Ids.SYNC_CURSOR_BLOB_ID_BASE = -0x100n;
|
|
76
86
|
Ids.UNSIGNED_64_BIT_MASK = (1n << 64n) - 1n;
|
|
77
87
|
Ids.UNSIGNED_32_BIT_MASK = (1n << 32n) - 1n;
|
|
78
88
|
export default Ids;
|
package/dist/Message.js
CHANGED
|
@@ -10,8 +10,9 @@ export default class Message extends Entity {
|
|
|
10
10
|
this._senderName = _senderName;
|
|
11
11
|
this._senderPhone = _senderPhone;
|
|
12
12
|
}
|
|
13
|
-
// The customer's
|
|
14
|
-
//
|
|
13
|
+
// The customer's party id at the business (BusinessLink.partyId), and not the id of their User. A business sync out
|
|
14
|
+
// sends a customer only the messages whose sender is their own party. senderName/senderPhone below say who it was
|
|
15
|
+
// without resolving the party.
|
|
15
16
|
get senderId() {
|
|
16
17
|
return this._senderId;
|
|
17
18
|
}
|
package/dist/Model.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export default class Model {
|
|
|
31
31
|
private businessSyncIn;
|
|
32
32
|
private syncAnonymousBusiness;
|
|
33
33
|
private syncBusinessContainer;
|
|
34
|
+
private readBusinessPages;
|
|
35
|
+
private static isBusinessNamed;
|
|
34
36
|
private requireBusinessLink;
|
|
35
37
|
private readJoinBusinessId;
|
|
36
38
|
private static findBusinessEntity;
|
|
@@ -48,6 +50,8 @@ export default class Model {
|
|
|
48
50
|
private buildProfileAuthTokens;
|
|
49
51
|
private requireProfileAuthTokens;
|
|
50
52
|
private publishBusiness;
|
|
53
|
+
private publish;
|
|
54
|
+
private static buildPublishable;
|
|
51
55
|
private publishProfile;
|
|
52
56
|
private static getService;
|
|
53
57
|
private static getCache;
|
|
@@ -58,6 +62,7 @@ export default class Model {
|
|
|
58
62
|
private _subjectId;
|
|
59
63
|
private _authenticationToken;
|
|
60
64
|
private _businessId;
|
|
65
|
+
private _isPublishedBusinessVetted;
|
|
61
66
|
private readonly _business;
|
|
62
67
|
private readonly _profile;
|
|
63
68
|
}
|