@peabody-soft/mbs-model-ts 1.4.0 → 1.6.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.
Files changed (91) hide show
  1. package/dist/Address.js +8 -11
  2. package/dist/Attachment.js +7 -8
  3. package/dist/AttachmentBaseUrl.js +10 -10
  4. package/dist/AuthTokens.js +12 -7
  5. package/dist/Business.js +19 -19
  6. package/dist/BusinessIdentifier.js +2 -2
  7. package/dist/BusinessLink.js +16 -16
  8. package/dist/BusinessProfile.js +4 -4
  9. package/dist/CartEditor.d.ts +10 -5
  10. package/dist/CartEditor.js +258 -180
  11. package/dist/Catalog.js +31 -29
  12. package/dist/Constants.js +10 -10
  13. package/dist/ContainerNames.js +10 -11
  14. package/dist/Entity.js +11 -9
  15. package/dist/Enums.d.ts +1 -1
  16. package/dist/Enums.js +4 -3
  17. package/dist/Exceptions.js +2 -2
  18. package/dist/GeneralSettings.d.ts +4 -2
  19. package/dist/GeneralSettings.js +30 -18
  20. package/dist/HttpStatusCodes.js +10 -11
  21. package/dist/Ids.d.ts +2 -0
  22. package/dist/Ids.js +28 -24
  23. package/dist/Item.js +6 -7
  24. package/dist/LatLong.js +3 -3
  25. package/dist/LiveData.js +6 -6
  26. package/dist/Measures.js +2 -2
  27. package/dist/Message.js +6 -5
  28. package/dist/MockDatabase.js +2 -2
  29. package/dist/Model.d.ts +5 -0
  30. package/dist/Model.js +400 -254
  31. package/dist/Order.js +20 -17
  32. package/dist/Package.js +7 -8
  33. package/dist/PackageIdentifier.js +2 -2
  34. package/dist/PaymentMethodDetail.js +4 -4
  35. package/dist/Photo.js +6 -7
  36. package/dist/Price.js +9 -6
  37. package/dist/PriceList.js +2 -2
  38. package/dist/Product.d.ts +5 -3
  39. package/dist/Product.js +26 -19
  40. package/dist/ProductCategory.js +3 -4
  41. package/dist/Profile.d.ts +1 -0
  42. package/dist/Profile.js +94 -8
  43. package/dist/ProtoMap.d.ts +18 -8
  44. package/dist/ProtoMap.js +451 -331
  45. package/dist/Routes.js +3 -3
  46. package/dist/ServiceExceptions.js +11 -12
  47. package/dist/ServiceProxy.js +19 -23
  48. package/dist/ShoppingList.d.ts +30 -1
  49. package/dist/ShoppingList.js +339 -47
  50. package/dist/SyncCache.d.ts +12 -0
  51. package/dist/SyncCache.js +136 -56
  52. package/dist/SyncKeys.js +8 -8
  53. package/dist/SyncState.js +5 -5
  54. package/dist/Tax.d.ts +12 -4
  55. package/dist/Tax.js +37 -13
  56. package/dist/TaxHelper.d.ts +12 -0
  57. package/dist/TaxHelper.js +85 -0
  58. package/dist/TaxType.d.ts +7 -0
  59. package/dist/TaxType.js +31 -0
  60. package/dist/UserProfile.js +4 -4
  61. package/dist/WorkingDays.js +15 -15
  62. package/dist/generated/AttachmentType.d.ts +19 -1
  63. package/dist/generated/AttachmentType.js +18 -0
  64. package/dist/generated/AuthTokens.d.ts +3 -1
  65. package/dist/generated/BusinessLink.d.ts +4 -1
  66. package/dist/generated/BusinessSyncInRequest.d.ts +11 -3
  67. package/dist/generated/BusinessSyncInResponse.d.ts +5 -4
  68. package/dist/generated/BusinessSyncOutRequest.d.ts +37 -10
  69. package/dist/generated/BusinessSyncOutRequest.js +42 -29
  70. package/dist/generated/BusinessSyncOutResponse.d.ts +14 -1
  71. package/dist/generated/Configuration.d.ts +2 -1
  72. package/dist/generated/CreateUserRequest.d.ts +8 -2
  73. package/dist/generated/Entity.d.ts +7 -3
  74. package/dist/generated/GeneralSettings.d.ts +14 -4
  75. package/dist/generated/GeneralSettings.js +9 -1
  76. package/dist/generated/Message.d.ts +4 -2
  77. package/dist/generated/Product.d.ts +10 -1
  78. package/dist/generated/Product.js +9 -1
  79. package/dist/generated/ProfileSyncOutRequest.d.ts +17 -1
  80. package/dist/generated/ProfileSyncOutResponse.d.ts +8 -3
  81. package/dist/generated/SalesOrderPayload.d.ts +7 -2
  82. package/dist/generated/ShoppingList.d.ts +6 -3
  83. package/dist/generated/ShoppingListItem.d.ts +21 -6
  84. package/dist/generated/Tax.d.ts +4 -4
  85. package/dist/generated/Tax.js +7 -8
  86. package/dist/generated/WorkingHoursRange.d.ts +2 -2
  87. package/dist/index.d.ts +2 -2
  88. package/dist/index.js +11 -10
  89. package/package.json +55 -55
  90. package/dist/generated/TaxType.d.ts +0 -25
  91. package/dist/generated/TaxType.js +0 -30
package/dist/LiveData.js CHANGED
@@ -1,6 +1,6 @@
1
- // A value that notifies its observers whenever it is set - the Android LiveData of this library, what every storefront UI binds to.
2
- // Deliberately skips LifecycleOwner and onActive/onInactive (no web equivalent / no need), and differs from mbl-model's Observations:
3
- // observe() returns its own unobserve function, holder gives a stable snapshot for React, observers are a Map for O(1) removal, and a value set mid-notification restarts rather than interleaves.
1
+ // A value that notifies its observers whenever it is set. This library's version of Android LiveData, which every storefront UI binds to.
2
+ // Skips LifecycleOwner and onActive/onInactive (no web equivalent, no need). Differs from mbl-model's Observations:
3
+ // observe() returns its own unobserve function, holder gives a stable snapshot for React, observers are a Map for O(1) removal, and a value set mid-notification restarts the notification instead of interleaving.
4
4
  class LiveData {
5
5
  constructor(value) {
6
6
  this._observers = new Map();
@@ -12,14 +12,14 @@ class LiveData {
12
12
  get value() {
13
13
  return this._holder.value;
14
14
  }
15
- // Private - only the sync layer (via an UpdatableLiveData cast) can set the value; a UI can only read/observe.
15
+ // Private. Only the sync layer (through an UpdatableLiveData cast) can set the value; a UI can only read and observe.
16
16
  set value(value) {
17
- // Always replaces the holder and notifies, even with the same reference - the interior may have changed and this class can't tell.
17
+ // Always replaces the holder and notifies, even for the same reference, since the interior may have changed and this class cannot tell.
18
18
  ++this._version;
19
19
  this._holder = new StateHolder(value);
20
20
  this.notifyObservers();
21
21
  }
22
- // The current value, wrapped so its identity changes exactly once per notification; use this instead of value for reference-equality snapshot comparisons.
22
+ // The current value, wrapped so its identity changes once per notification. Use this instead of value for reference-equality snapshot comparisons.
23
23
  get holder() {
24
24
  return this._holder;
25
25
  }
package/dist/Measures.js CHANGED
@@ -1,5 +1,5 @@
1
- // How big a package is, and how much it weighs - grouped together since a UI showing one usually shows both. Neither is an entity; both are values on the Package row.
2
- // Units are the generated proto enums, so a value displays in whatever unit the merchant entered it in; nothing here converts between units.
1
+ // How big a package is and how much it weighs, grouped since a UI showing one usually shows both. Neither is an entity; both are values on the Package row.
2
+ // Units are the generated proto enums. A value displays in the unit the merchant entered it in, and nothing here converts between units.
3
3
  export class Dimensions {
4
4
  constructor(_unit, _length, _width, _height) {
5
5
  this._unit = _unit;
package/dist/Message.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import Entity from "./Entity";
2
- // Something a customer sent to a business: an order (sales order) or a shopping cart (party preferences) - the two payloads this library understands.
3
- // A business entity despite being customer-authored, since Java authorizes the message table via Right.MESSAGES_MODIFY against the business.
2
+ // Something a customer sent to a business: an order (sales order) or a shopping cart (party preferences), the two payloads this library understands.
3
+ // A business entity despite being customer-authored, since Java authorizes the message table through Right.MESSAGES_MODIFY against the business.
4
4
  export default class Message extends Entity {
5
5
  constructor(header, _senderId, _messageType, _taskStatus, _senderName, _senderPhone) {
6
6
  super(header);
@@ -10,15 +10,16 @@ export default class Message extends Entity {
10
10
  this._senderName = _senderName;
11
11
  this._senderPhone = _senderPhone;
12
12
  }
13
- // The customer's User id; a business sync out doesn't carry it, so it's resolvable only against a profile sync out.
14
- // senderName/senderPhone below are the fallback a UI shows meanwhile, and all an anonymous client ever has.
13
+ // The customer's party id at the business (BusinessLink.partyId), not the id of their User. A
14
+ // business sync out sends a customer only messages from their own party. senderName and
15
+ // senderPhone say who it was without resolving the party.
15
16
  get senderId() {
16
17
  return this._senderId;
17
18
  }
18
19
  get messageType() {
19
20
  return this._messageType;
20
21
  }
21
- // How far the business has got with this message. Named after its enum, not the wire field "status", to avoid clashing with Order.status.
22
+ // How far the business has got with this message. Named after its enum rather than the wire field "status", which would clash with Order.status.
22
23
  get taskStatus() {
23
24
  return this._taskStatus;
24
25
  }
@@ -1,5 +1,5 @@
1
1
  // A Database that holds everything in a Map, for tests and training mode to run against with no
2
- // network. Enforces the eTag rule for real (write only if the new eTag is greater), so a test proves the sync is actually idempotent.
2
+ // network. Enforces the eTag rule (write only if the new eTag is greater), so a test proves the sync is idempotent.
3
3
  export default class MockDatabase {
4
4
  constructor() {
5
5
  this._containers = new Map();
@@ -51,7 +51,7 @@ export class MockContainer {
51
51
  this._blobs.set(blob.id, blob);
52
52
  ++appliedCount;
53
53
  }
54
- // Unconditional, and after the writes, exactly as the Database contract says
54
+ // After the writes, as the Database contract says
55
55
  for (const id of deletes)
56
56
  this._blobs.delete(id);
57
57
  return appliedCount;
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
  }