@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
@@ -1,9 +1,9 @@
1
1
  import { Constants as proto_Constants } from "./generated/Constants";
2
2
  import { InvalidArgumentException } from "./Exceptions";
3
3
  // Days and hours a business works. Absence is the permissive value throughout: no WorkingDays
4
- // means every day (ALL_DAYS); a day with no hours/ranges means worked all day.
5
- // The hours are minutes after local midnight in timeZone, so a caller asking about a moment reads
6
- // it in that zone first, as a day and a minute.
4
+ // means every day (ALL_DAYS), and a day with no hours or ranges is worked all day.
5
+ // Hours are minutes after local midnight in timeZone, so a caller asking about a moment reads it
6
+ // in that zone first, as a day and a minute.
7
7
  class WorkingDays {
8
8
  constructor(_days, _timeZone, _workingHours) {
9
9
  this._days = _days;
@@ -15,15 +15,15 @@ class WorkingDays {
15
15
  get days() {
16
16
  return this._days;
17
17
  }
18
- // The IANA ID of the zone the hours are in, for example "Asia/Kolkata" - never an abbreviation
19
- // like "IST". Null when none was specified: settings saved before the protocol carried one, and
20
- // ALL_DAYS. Then the hours cannot be placed on a clock, and only a caller that knows the
18
+ // The IANA ID of the zone the hours are in, for example "Asia/Kolkata", never an abbreviation
19
+ // like "IST". Null when none was specified (settings saved before the protocol carried one, and
20
+ // ALL_DAYS). The hours then cannot be placed on a clock, and only a caller that knows the
21
21
  // business's zone can read a moment into them.
22
22
  get timeZone() {
23
23
  return this._timeZone;
24
24
  }
25
- // Indexed exactly as days above. Shorter than days, or empty, is normal: see the comment on
26
- // this class for what a missing entry means.
25
+ // Indexed as days is. Shorter than days, or empty, is normal. See the class comment for what a
26
+ // missing entry means.
27
27
  get workingHours() {
28
28
  return this._workingHours;
29
29
  }
@@ -37,8 +37,8 @@ class WorkingDays {
37
37
  WorkingDays.checkDayOfWeek(dayOfWeek);
38
38
  return this._days[dayOfWeek] === true;
39
39
  }
40
- // The hours of a day that is worked, or null when that day is worked all day long or is not
41
- // worked at all. A UI showing opening times treats null as all day, having tested the day first.
40
+ // The hours of a worked day, or null when that day is worked all day or not at all. A UI showing
41
+ // opening times tests the day first, then treats null as all day.
42
42
  getWorkingHours(dayOfWeek) {
43
43
  WorkingDays.checkDayOfWeek(dayOfWeek);
44
44
  if (dayOfWeek >= this._workingHours.length)
@@ -58,13 +58,13 @@ class WorkingDays {
58
58
  // there is nothing for a zone to place, so it has none.
59
59
  WorkingDays.ALL_DAYS = new WorkingDays(Object.freeze([true, true, true, true, true, true, true]), null, Object.freeze([]));
60
60
  export default WorkingDays;
61
- // The hours of a single day that are worked, as the stretches of it that are.
61
+ // The worked hours of a single day, as ranges.
62
62
  export class WorkingHours {
63
63
  constructor(_ranges) {
64
64
  this._ranges = _ranges;
65
65
  }
66
- // Ordered by openMinute, never overlapping, and never touching: a range that closes exactly when
67
- // the next opens arrives as one unbroken range.
66
+ // Ordered by openMinute, non-overlapping and non-touching: a range that closes when the next
67
+ // opens arrives as one unbroken range.
68
68
  get ranges() {
69
69
  return this._ranges;
70
70
  }
@@ -108,8 +108,8 @@ export class WorkingHoursRange {
108
108
  get openMinute() {
109
109
  return this._openMinute;
110
110
  }
111
- // Not worked; MINUTES_PER_DAY means work stops at midnight. Always > openMinute - a range never
112
- // spans midnight, so overnight work is two ranges on two days.
111
+ // Not worked; MINUTES_PER_DAY means work stops at midnight. Always greater than openMinute. A
112
+ // range never spans midnight, so overnight work is two ranges on two days.
113
113
  get closeMinute() {
114
114
  return this._closeMinute;
115
115
  }
@@ -154,5 +154,23 @@ export declare enum AttachmentType {
154
154
  /**
155
155
  * @generated from protobuf enum value: TRANSACTION_3 = 83;
156
156
  */
157
- TRANSACTION_3 = 83
157
+ TRANSACTION_3 = 83,
158
+ /**
159
+ * Other kinds of image that an attachment can be
160
+ *
161
+ * @generated from protobuf enum value: AI_GENERATED_PHOTO = 90;
162
+ */
163
+ AI_GENERATED_PHOTO = 90,
164
+ /**
165
+ * @generated from protobuf enum value: CAMERA_CAPTURE_PHOTO = 91;
166
+ */
167
+ CAMERA_CAPTURE_PHOTO = 91,
168
+ /**
169
+ * @generated from protobuf enum value: BUSINESS_CARD_IMAGE = 92;
170
+ */
171
+ BUSINESS_CARD_IMAGE = 92,
172
+ /**
173
+ * @generated from protobuf enum value: GREETING_IMAGE = 93;
174
+ */
175
+ GREETING_IMAGE = 93
158
176
  }
@@ -160,4 +160,22 @@ export var AttachmentType;
160
160
  * @generated from protobuf enum value: TRANSACTION_3 = 83;
161
161
  */
162
162
  AttachmentType[AttachmentType["TRANSACTION_3"] = 83] = "TRANSACTION_3";
163
+ /**
164
+ * Other kinds of image that an attachment can be
165
+ *
166
+ * @generated from protobuf enum value: AI_GENERATED_PHOTO = 90;
167
+ */
168
+ AttachmentType[AttachmentType["AI_GENERATED_PHOTO"] = 90] = "AI_GENERATED_PHOTO";
169
+ /**
170
+ * @generated from protobuf enum value: CAMERA_CAPTURE_PHOTO = 91;
171
+ */
172
+ AttachmentType[AttachmentType["CAMERA_CAPTURE_PHOTO"] = 91] = "CAMERA_CAPTURE_PHOTO";
173
+ /**
174
+ * @generated from protobuf enum value: BUSINESS_CARD_IMAGE = 92;
175
+ */
176
+ AttachmentType[AttachmentType["BUSINESS_CARD_IMAGE"] = 92] = "BUSINESS_CARD_IMAGE";
177
+ /**
178
+ * @generated from protobuf enum value: GREETING_IMAGE = 93;
179
+ */
180
+ AttachmentType[AttachmentType["GREETING_IMAGE"] = 93] = "GREETING_IMAGE";
163
181
  })(AttachmentType || (AttachmentType = {}));
@@ -23,7 +23,9 @@ export interface AuthTokens {
23
23
  authenticationMethod: AuthenticationMethod;
24
24
  /**
25
25
  * The credential from that identity provider - a Firebase id token when the method is FIREBASE.
26
- * Always set. Not issued or renewed by this server; refreshed with the identity provider.
26
+ * Always set in a request. Blank in a response, which carries the tokens that the server renewed:
27
+ * it never echoes this back, as it belongs to the identity provider, so, a client keeps the one that it
28
+ * holds. Not issued or renewed by this server; refreshed with the identity provider.
27
29
  *
28
30
  * @generated from protobuf field: string authenticationToken = 2
29
31
  */
@@ -43,7 +43,10 @@ export interface BusinessLink {
43
43
  role: Role;
44
44
  /**
45
45
  * Id of the party record of the linked entity within that business, or Constants.ENTITY_ID_NULL
46
- * when there is none. Not resolvable by a storefront - Party is not generated by this protocol.
46
+ * when there is none. A link that has been blocked has the invalid party id that Java names
47
+ * Party.INVALID_PARTY_ID instead, which is not zero (it is the id of a party whose low part is
48
+ * zero, 0x0800000000000000), so, a partyId that is not zero is not always a party.
49
+ * Not resolvable by a storefront - Party is not generated by this protocol.
47
50
  *
48
51
  * @generated from protobuf field: int64 partyId = 5
49
52
  */
@@ -7,16 +7,24 @@ import { MessageType } from "@protobuf-ts/runtime";
7
7
  import { Message } from "./Message";
8
8
  /**
9
9
  * Pushes the business entities a customer has changed - their shopping cart and the orders placed
10
- * from it - to one business database, named the same way a BusinessSyncOutRequest names it.
10
+ * from it - to one business database. The request names no business: the link token in the
11
+ * AuthTokens of the authorization header does, as a link names exactly one.
12
+ * Not implemented yet: the route (shopBusinessSyncIn) answers 501, and what is said here and in the
13
+ * BusinessSyncInResponse is the contract that it is to meet, and not behaviour that the server has.
14
+ * ProtoMap.fromProto accepts the paymentReceived of an order, and the senderId and status of a message,
15
+ * as they are sent, so, sync in has to enforce who may set each of them when it is written.
11
16
  * An entity being synced in carries the id it already has, or Constants.ENTITY_ID_NULL if the
12
17
  * caller is creating it and the server is to assign one; incoming update numbers are the caller's
13
- * own and are replaced by the server, which returns the new ones in the BusinessSyncInResponse.
18
+ * own and are replaced by the server, which returns the messages bearing the new ones in the
19
+ * BusinessSyncInResponse.
14
20
  *
15
21
  * @generated from protobuf message com.merabills.storefront.BusinessSyncInRequest
16
22
  */
17
23
  export interface BusinessSyncInRequest {
18
24
  /**
19
- * Client-side cursor for the customer's orders and shopping cart (Constants.MESSAGE_ENTITY_TYPE_ID).
25
+ * Client-side cursor for the customer's orders and shopping cart (Constants.MESSAGE_ENTITY_TYPE_ID):
26
+ * how far the client's sync outs of them have got, which is not moved by a push. The answer to a push
27
+ * is only the messages that were pushed, so, it does not depend on this.
20
28
  *
21
29
  * @generated from protobuf field: int64 messageUpdateNumber = 1
22
30
  */
@@ -7,10 +7,11 @@ import { MessageType } from "@protobuf-ts/runtime";
7
7
  import { Message } from "./Message";
8
8
  import { AuthTokens } from "./AuthTokens";
9
9
  /**
10
- * The answer to a BusinessSyncInRequest: the update number the server assigned to the pushed
11
- * entities, one per entity type. Raise the matching cursor to this value so the next sync out does
12
- * not fetch back what was just sent; 0 means nothing of that type was accepted. Carries no entities
13
- * - sync out again to see the server's view of what was pushed.
10
+ * Not implemented yet (the route answers 501): this is the contract that it is to meet.
11
+ * The answer to a BusinessSyncInRequest: the messages the server now holds for what was pushed,
12
+ * which bear the update numbers it assigned, and any tokens it renewed. A push is not a read, so, do
13
+ * not move the message cursor with these update numbers: a change somebody else made, with an update
14
+ * number below them, would then never be sent. The next sync out returns what was pushed as well.
14
15
  *
15
16
  * @generated from protobuf message com.merabills.storefront.BusinessSyncInResponse
16
17
  */
@@ -10,54 +10,81 @@ import { MessageType } from "@protobuf-ts/runtime";
10
10
  * Entity.updateNumber of that type already synced (0 asks for everything), and a response of
11
11
  * Constants.SYNC_OUT_LIMIT entities means call again with the updated cursors. The caller and the
12
12
  * business's link token are in the AuthTokens of the authorization header, not in this message.
13
+ * The call fails with 404 (NotFoundException) when the business does not exist, has been deleted,
14
+ * or does not allow customers to join it, whoever the caller is - see BusinessSyncOutResponse.
15
+ * Whether it has turned online shopping on is not a refusal: that is for the client to decide.
13
16
  *
14
17
  * @generated from protobuf message com.merabills.storefront.BusinessSyncOutRequest
15
18
  */
16
19
  export interface BusinessSyncOutRequest {
17
20
  /**
18
- * The business to sync out, by its unique, lower case, url friendly id (Constants.BUSINESS_ID_MIN_LENGTH
19
- * to Constants.BUSINESS_ID_MAX_LENGTH).
21
+ * The business to sync out, named one way or the other, and one of the two is required. A client that
22
+ * does not yet hold the Business names it by its businessId, and one that does names it by the entity id
23
+ * it read there (Business.entity.id), which is what every later read is to use. The pages of one read are
24
+ * that read, and go on naming the business the way its first request did.
20
25
  *
21
- * @generated from protobuf field: string businessId = 1
26
+ * @generated from protobuf oneof: business
22
27
  */
23
- businessId: string;
28
+ business: {
29
+ oneofKind: "businessId";
30
+ /**
31
+ * Its unique, lower case, url friendly id (Constants.BUSINESS_ID_MIN_LENGTH to
32
+ * Constants.BUSINESS_ID_MAX_LENGTH). One that names no business, which includes one that is not a
33
+ * possible id, is the same as a business that does not exist. This is for a caller that has no link
34
+ * token: a link token is refused together with it, and is to be sent with businessEntityId.
35
+ *
36
+ * @generated from protobuf field: string businessId = 1
37
+ */
38
+ businessId: string;
39
+ } | {
40
+ oneofKind: "businessEntityId";
41
+ /**
42
+ * Its entity id, which has to be that of a business. If the AuthTokens carry a link token, it has to
43
+ * be the link token of this business, and a link token of any other is refused.
44
+ *
45
+ * @generated from protobuf field: int64 businessEntityId = 2
46
+ */
47
+ businessEntityId: bigint;
48
+ } | {
49
+ oneofKind: undefined;
50
+ };
24
51
  /**
25
52
  * Cursor for the Business entity (Constants.BUSINESS_ENTITY_TYPE_ID). Separate from, and never
26
53
  * mixed with, ProfileSyncOutRequest.businessUpdateNumber.
27
54
  *
28
- * @generated from protobuf field: int64 businessUpdateNumber = 2
55
+ * @generated from protobuf field: int64 businessUpdateNumber = 3
29
56
  */
30
57
  businessUpdateNumber: bigint;
31
58
  /**
32
59
  * Cursor for photos of the business, its products and its packages (Constants.ATTACHMENT_ENTITY_TYPE_ID).
33
60
  *
34
- * @generated from protobuf field: int64 attachmentUpdateNumber = 3
61
+ * @generated from protobuf field: int64 attachmentUpdateNumber = 4
35
62
  */
36
63
  attachmentUpdateNumber: bigint;
37
64
  /**
38
65
  * The UrlAndToken.expiry of the attachment base url this client is holding, sent back unchanged;
39
66
  * 0 means it holds none. A time, not a cursor - it does not rise monotonically.
40
67
  *
41
- * @generated from protobuf field: int64 attachmentBaseUrlExpiry = 4
68
+ * @generated from protobuf field: int64 attachmentBaseUrlExpiry = 5
42
69
  */
43
70
  attachmentBaseUrlExpiry: bigint;
44
71
  /**
45
72
  * Cursor for the business's settings (Constants.CONFIGURATION_ENTITY_TYPE_ID).
46
73
  *
47
- * @generated from protobuf field: int64 configurationUpdateNumber = 5
74
+ * @generated from protobuf field: int64 configurationUpdateNumber = 6
48
75
  */
49
76
  configurationUpdateNumber: bigint;
50
77
  /**
51
78
  * Cursor for the customer's orders and shopping cart (Constants.MESSAGE_ENTITY_TYPE_ID).
52
79
  *
53
- * @generated from protobuf field: int64 messageUpdateNumber = 6
80
+ * @generated from protobuf field: int64 messageUpdateNumber = 7
54
81
  */
55
82
  messageUpdateNumber: bigint;
56
83
  /**
57
84
  * Cursor for the whole catalog - product categories, products, packages, price lists and prices,
58
85
  * which all share this one cursor (Constants.ITEM_ENTITY_TYPE_ID).
59
86
  *
60
- * @generated from protobuf field: int64 itemUpdateNumber = 7
87
+ * @generated from protobuf field: int64 itemUpdateNumber = 8
61
88
  */
62
89
  itemUpdateNumber: bigint;
63
90
  }
@@ -6,18 +6,19 @@ import { MessageType } from "@protobuf-ts/runtime";
6
6
  class BusinessSyncOutRequest$Type extends MessageType {
7
7
  constructor() {
8
8
  super("com.merabills.storefront.BusinessSyncOutRequest", [
9
- { no: 1, name: "businessId", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
10
- { no: 2, name: "businessUpdateNumber", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
11
- { no: 3, name: "attachmentUpdateNumber", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
12
- { no: 4, name: "attachmentBaseUrlExpiry", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
13
- { no: 5, name: "configurationUpdateNumber", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
14
- { no: 6, name: "messageUpdateNumber", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
15
- { no: 7, name: "itemUpdateNumber", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
9
+ { no: 1, name: "businessId", kind: "scalar", oneof: "business", T: 9 /*ScalarType.STRING*/ },
10
+ { no: 2, name: "businessEntityId", kind: "scalar", oneof: "business", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
11
+ { no: 3, name: "businessUpdateNumber", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
12
+ { no: 4, name: "attachmentUpdateNumber", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
13
+ { no: 5, name: "attachmentBaseUrlExpiry", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
14
+ { no: 6, name: "configurationUpdateNumber", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
15
+ { no: 7, name: "messageUpdateNumber", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
16
+ { no: 8, name: "itemUpdateNumber", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
16
17
  ]);
17
18
  }
18
19
  create(value) {
19
20
  const message = globalThis.Object.create((this.messagePrototype));
20
- message.businessId = "";
21
+ message.business = { oneofKind: undefined };
21
22
  message.businessUpdateNumber = 0n;
22
23
  message.attachmentUpdateNumber = 0n;
23
24
  message.attachmentBaseUrlExpiry = 0n;
@@ -34,24 +35,33 @@ class BusinessSyncOutRequest$Type extends MessageType {
34
35
  let [fieldNo, wireType] = reader.tag();
35
36
  switch (fieldNo) {
36
37
  case /* string businessId */ 1:
37
- message.businessId = reader.string();
38
+ message.business = {
39
+ oneofKind: "businessId",
40
+ businessId: reader.string()
41
+ };
38
42
  break;
39
- case /* int64 businessUpdateNumber */ 2:
43
+ case /* int64 businessEntityId */ 2:
44
+ message.business = {
45
+ oneofKind: "businessEntityId",
46
+ businessEntityId: reader.int64().toBigInt()
47
+ };
48
+ break;
49
+ case /* int64 businessUpdateNumber */ 3:
40
50
  message.businessUpdateNumber = reader.int64().toBigInt();
41
51
  break;
42
- case /* int64 attachmentUpdateNumber */ 3:
52
+ case /* int64 attachmentUpdateNumber */ 4:
43
53
  message.attachmentUpdateNumber = reader.int64().toBigInt();
44
54
  break;
45
- case /* int64 attachmentBaseUrlExpiry */ 4:
55
+ case /* int64 attachmentBaseUrlExpiry */ 5:
46
56
  message.attachmentBaseUrlExpiry = reader.int64().toBigInt();
47
57
  break;
48
- case /* int64 configurationUpdateNumber */ 5:
58
+ case /* int64 configurationUpdateNumber */ 6:
49
59
  message.configurationUpdateNumber = reader.int64().toBigInt();
50
60
  break;
51
- case /* int64 messageUpdateNumber */ 6:
61
+ case /* int64 messageUpdateNumber */ 7:
52
62
  message.messageUpdateNumber = reader.int64().toBigInt();
53
63
  break;
54
- case /* int64 itemUpdateNumber */ 7:
64
+ case /* int64 itemUpdateNumber */ 8:
55
65
  message.itemUpdateNumber = reader.int64().toBigInt();
56
66
  break;
57
67
  default:
@@ -67,26 +77,29 @@ class BusinessSyncOutRequest$Type extends MessageType {
67
77
  }
68
78
  internalBinaryWrite(message, writer, options) {
69
79
  /* string businessId = 1; */
70
- if (message.businessId !== "")
71
- writer.tag(1, WireType.LengthDelimited).string(message.businessId);
72
- /* int64 businessUpdateNumber = 2; */
80
+ if (message.business.oneofKind === "businessId")
81
+ writer.tag(1, WireType.LengthDelimited).string(message.business.businessId);
82
+ /* int64 businessEntityId = 2; */
83
+ if (message.business.oneofKind === "businessEntityId")
84
+ writer.tag(2, WireType.Varint).int64(message.business.businessEntityId);
85
+ /* int64 businessUpdateNumber = 3; */
73
86
  if (message.businessUpdateNumber !== 0n)
74
- writer.tag(2, WireType.Varint).int64(message.businessUpdateNumber);
75
- /* int64 attachmentUpdateNumber = 3; */
87
+ writer.tag(3, WireType.Varint).int64(message.businessUpdateNumber);
88
+ /* int64 attachmentUpdateNumber = 4; */
76
89
  if (message.attachmentUpdateNumber !== 0n)
77
- writer.tag(3, WireType.Varint).int64(message.attachmentUpdateNumber);
78
- /* int64 attachmentBaseUrlExpiry = 4; */
90
+ writer.tag(4, WireType.Varint).int64(message.attachmentUpdateNumber);
91
+ /* int64 attachmentBaseUrlExpiry = 5; */
79
92
  if (message.attachmentBaseUrlExpiry !== 0n)
80
- writer.tag(4, WireType.Varint).int64(message.attachmentBaseUrlExpiry);
81
- /* int64 configurationUpdateNumber = 5; */
93
+ writer.tag(5, WireType.Varint).int64(message.attachmentBaseUrlExpiry);
94
+ /* int64 configurationUpdateNumber = 6; */
82
95
  if (message.configurationUpdateNumber !== 0n)
83
- writer.tag(5, WireType.Varint).int64(message.configurationUpdateNumber);
84
- /* int64 messageUpdateNumber = 6; */
96
+ writer.tag(6, WireType.Varint).int64(message.configurationUpdateNumber);
97
+ /* int64 messageUpdateNumber = 7; */
85
98
  if (message.messageUpdateNumber !== 0n)
86
- writer.tag(6, WireType.Varint).int64(message.messageUpdateNumber);
87
- /* int64 itemUpdateNumber = 7; */
99
+ writer.tag(7, WireType.Varint).int64(message.messageUpdateNumber);
100
+ /* int64 itemUpdateNumber = 8; */
88
101
  if (message.itemUpdateNumber !== 0n)
89
- writer.tag(7, WireType.Varint).int64(message.itemUpdateNumber);
102
+ writer.tag(8, WireType.Varint).int64(message.itemUpdateNumber);
90
103
  let u = options.writeUnknownFields;
91
104
  if (u !== false)
92
105
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -23,6 +23,15 @@ import { AuthTokens } from "./AuthTokens";
23
23
  * (updateNumber's update-type bits = Constants.UPDATE_TYPE_DELETED) means the entity, and what it
24
24
  * owned, was deleted. At most Constants.SYNC_OUT_LIMIT entities arrive together - that many means
25
25
  * call again with the raised cursors.
26
+ * There is no response, but a 404 (NotFoundException), when the business is not one a storefront can
27
+ * open: it does not exist or has been deleted, or it does not allow customers to join it. Both are
28
+ * looked at on every call, whatever the cursors are, and are the same to every caller: one that holds
29
+ * a link token of the business, a customer that joined it, is told no differently.
30
+ * A client that has the business cached and is told this must stop showing it.
31
+ * Whether the business has turned online shopping on is not looked at: a client that has read all it
32
+ * is sent decides it from the GeneralSettings that it then holds (onlineShoppingEnabled). Settings that
33
+ * are not there, or that have been deleted, or that say it has not, make it a business that a storefront
34
+ * cannot open, and a client that finds so must stop showing it as if it had been told this.
26
35
  *
27
36
  * @generated from protobuf message com.merabills.storefront.BusinessSyncOutResponse
28
37
  */
@@ -35,8 +44,12 @@ export interface BusinessSyncOutResponse {
35
44
  */
36
45
  authTokens?: AuthTokens;
37
46
  /**
38
- * The business named by the request. Absent unless it has changed. Also carried by a
47
+ * The business named by the request, which is how a client that named it by its businessId learns
48
+ * its entity id for the calls that follow. Absent unless it has changed. Also carried by a
39
49
  * ProfileSyncOutResponse, with its own separate cursor - keep the two update numbers apart.
50
+ * The businessId of a business can change, and this arriving changed is the only thing that says so: a
51
+ * client that was asked to open a business by its businessId, and holds it by its entity id, compares the
52
+ * two once it has read all it is sent, as the entity id does not say which business that businessId names now.
40
53
  *
41
54
  * @generated from protobuf field: com.merabills.storefront.Business business = 2
42
55
  */
@@ -26,7 +26,8 @@ export interface Configuration {
26
26
  oneofKind: "generalSettings";
27
27
  /**
28
28
  * The publicly visible settings of the business, held in the configuration whose id is
29
- * Configuration.MIN_PUBLIC_CONFIGURATION_ID
29
+ * Configuration.MIN_PUBLIC_CONFIGURATION_ID. Not set for settings that the server cannot read, which are a
30
+ * business that made none
30
31
  *
31
32
  * @generated from protobuf field: com.merabills.storefront.GeneralSettings generalSettings = 2
32
33
  */
@@ -6,7 +6,11 @@ import type { PartialMessage } from "@protobuf-ts/runtime";
6
6
  import { MessageType } from "@protobuf-ts/runtime";
7
7
  import { User } from "./User";
8
8
  /**
9
- * Creates a new user, optionally joining it to a business as a customer in the same call.
9
+ * Creates a new user, optionally joining it to a business as a customer in the same call, and is
10
+ * answered with a ProfileSyncOutResponse. Not implemented yet: the route (shopCreateUser) answers 501, and
11
+ * every rule below is the contract that it is to meet, and not behaviour that the server has. See
12
+ * Prompt.txt, CREATE USER AND UPDATE USER, which also gives the contract of the route that updates the
13
+ * caller's own user (its request is a bare User, matched to the caller by entity.id).
10
14
  *
11
15
  * @generated from protobuf message com.merabills.storefront.CreateUserRequest
12
16
  */
@@ -18,7 +22,9 @@ export interface CreateUserRequest {
18
22
  */
19
23
  user?: User;
20
24
  /**
21
- * The business to join as a customer after creating the user. 0 means none.
25
+ * The business to join as a customer after creating the user. 0 means none, and anything else has to be
26
+ * the id of a business: one that is not is refused, not ignored. One that cannot be joined is to be refused
27
+ * as ProfileSyncOutRequest.joinBusinessId says - a 404, and the user is created all the same.
22
28
  *
23
29
  * @generated from protobuf field: int64 joinBusinessId = 2
24
30
  */
@@ -28,9 +28,13 @@ export interface Entity {
28
28
  updatedAt: bigint;
29
29
  /**
30
30
  * Id of the database that last updated this entity; Constants.MASTER_DB_ID means the server. A
31
- * client stamps its own id here on every entity it pushes, so its own writes are not sent back to
32
- * it on the next sync out. Only set on business-database entities (Attachment, Configuration,
33
- * Message, Item); always 0 on the profile entities User, Business and BusinessLink.
31
+ * client that has a database of its own (a merchant app) stamps its own id here on every entity
32
+ * it pushes, so its own writes are not sent back to it on the next sync out. A storefront has no
33
+ * database of its own: it leaves this zero, and its sync outs leave out nobody's changes, but
34
+ * return everything newer than the cursors - what the caller itself pushed included, which
35
+ * changes nothing that it holds. Only set on business-database entities (Attachment,
36
+ * Configuration, Message, Item); always 0 on the profile entities User, Business and
37
+ * BusinessLink.
34
38
  *
35
39
  * @generated from protobuf field: int64 updateInfo = 3
36
40
  */
@@ -15,8 +15,8 @@ import { PaymentMethodDetail } from "./PaymentMethodDetail";
15
15
  * The publicly visible settings of a business - tagline, contact info, location, fulfillment,
16
16
  * payment and delivery options, and online store presentation - held in the value of the
17
17
  * business's public Configuration entity.
18
- * Excluded: onlineShoppingEnabled, and the fields of the StoreSettings base class (authToken,
19
- * authTokenExpiry, lastSuccessfulSync and fees).
18
+ * Excluded: the fields of the StoreSettings base class (authToken, authTokenExpiry,
19
+ * lastSuccessfulSync and fees).
20
20
  * Not included because it is a constant: overdueAfterMillis.
21
21
  *
22
22
  * @generated from protobuf message com.merabills.storefront.GeneralSettings
@@ -65,13 +65,14 @@ export interface GeneralSettings {
65
65
  */
66
66
  fulfillmentModes: FulfillmentMode[];
67
67
  /**
68
- * Charge for delivering an order, multiplied by Constants.AMOUNT_FACTOR
68
+ * Charge for delivering an order, including the taxes in deliveryChargeTaxes, multiplied by
69
+ * Constants.AMOUNT_FACTOR
69
70
  *
70
71
  * @generated from protobuf field: int64 deliveryCharge = 8
71
72
  */
72
73
  deliveryCharge: bigint;
73
74
  /**
74
- * Taxes that apply to deliveryCharge (at most Constants.MAX_TAXES)
75
+ * Taxes that are included in deliveryCharge (at most Constants.MAX_TAXES)
75
76
  *
76
77
  * @generated from protobuf field: repeated com.merabills.storefront.Tax deliveryChargeTaxes = 9
77
78
  */
@@ -127,6 +128,15 @@ export interface GeneralSettings {
127
128
  * @generated from protobuf field: optional string onlineStoreThemeId = 17
128
129
  */
129
130
  onlineStoreThemeId?: string;
131
+ /**
132
+ * True if the business has turned online shopping on. The server does not refuse a business that has
133
+ * not: it is for the client to, once it has read all it is sent (see BusinessSyncOutResponse). A
134
+ * business with no general settings at all, or with settings that have been deleted, has not turned
135
+ * it on either.
136
+ *
137
+ * @generated from protobuf field: bool onlineShoppingEnabled = 18
138
+ */
139
+ onlineShoppingEnabled: boolean;
130
140
  }
131
141
  declare class GeneralSettings$Type extends MessageType<GeneralSettings> {
132
142
  constructor();
@@ -29,7 +29,8 @@ class GeneralSettings$Type extends MessageType {
29
29
  { no: 14, name: "primaryStoreLocation", kind: "message", T: () => LatLong },
30
30
  { no: 15, name: "googleBusinessCategoryId", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ },
31
31
  { no: 16, name: "googleBusinessCategoryName", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ },
32
- { no: 17, name: "onlineStoreThemeId", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }
32
+ { no: 17, name: "onlineStoreThemeId", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ },
33
+ { no: 18, name: "onlineShoppingEnabled", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
33
34
  ]);
34
35
  }
35
36
  create(value) {
@@ -43,6 +44,7 @@ class GeneralSettings$Type extends MessageType {
43
44
  message.deliveryChargeTaxes = [];
44
45
  message.freeDeliveryTotal = 0n;
45
46
  message.deliveryRadiusKms = 0;
47
+ message.onlineShoppingEnabled = false;
46
48
  if (value !== undefined)
47
49
  reflectionMergePartial(this, message, value);
48
50
  return message;
@@ -107,6 +109,9 @@ class GeneralSettings$Type extends MessageType {
107
109
  case /* optional string onlineStoreThemeId */ 17:
108
110
  message.onlineStoreThemeId = reader.string();
109
111
  break;
112
+ case /* bool onlineShoppingEnabled */ 18:
113
+ message.onlineShoppingEnabled = reader.bool();
114
+ break;
110
115
  default:
111
116
  let u = options.readUnknownField;
112
117
  if (u === "throw")
@@ -174,6 +179,9 @@ class GeneralSettings$Type extends MessageType {
174
179
  /* optional string onlineStoreThemeId = 17; */
175
180
  if (message.onlineStoreThemeId !== undefined)
176
181
  writer.tag(17, WireType.LengthDelimited).string(message.onlineStoreThemeId);
182
+ /* bool onlineShoppingEnabled = 18; */
183
+ if (message.onlineShoppingEnabled !== false)
184
+ writer.tag(18, WireType.Varint).bool(message.onlineShoppingEnabled);
177
185
  let u = options.writeUnknownFields;
178
186
  if (u !== false)
179
187
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -22,8 +22,10 @@ export interface Message {
22
22
  */
23
23
  entity?: Entity;
24
24
  /**
25
- * Id of the User that sent this message. Not carried by a business sync out - resolve against a
26
- * profile sync out, or use senderName / senderPhone below.
25
+ * Id of the party that sent this message - Java Message.senderId, which is a party id and not the id
26
+ * of a User: the party of the BusinessLink of the sender (BusinessLink.partyId). Carried by a business
27
+ * sync out, which sends a customer only the messages whose sender is their own party. senderName /
28
+ * senderPhone below say who it was without resolving the party.
27
29
  *
28
30
  * @generated from protobuf field: int64 senderId = 2
29
31
  */
@@ -12,7 +12,7 @@ import { Item } from "./Item";
12
12
  * A product (goods, service, raw material or fixed asset) in the catalog of a business. Belongs to
13
13
  * at most one category (Item.parentItemId, 0 = none); its packages and photos are found the same
14
14
  * way, by parentItemId / owningEntityId.
15
- * Excluded: isDraft, forOfflineSaleOnly, isStockKeepingEnabled, isExpiryTrackingEnabled,
15
+ * Excluded: isDraft, isStockKeepingEnabled, isExpiryTrackingEnabled,
16
16
  * storeProperties, defaultExpiry, classifications, all Translations fields.
17
17
  *
18
18
  * @generated from protobuf message com.merabills.storefront.Product
@@ -63,6 +63,15 @@ export interface Product {
63
63
  * @generated from protobuf field: repeated string features = 8
64
64
  */
65
65
  features: string[];
66
+ /**
67
+ * True when the business sells this product only offline (Java Product.getForOfflineSaleOnly: the product has "available
68
+ * online" turned off). The server sends such a product like any other public one, and it is for the client to not show
69
+ * it, nor its packages, to a customer, nor let a customer order it (mbs-model's Catalog leaves it out). Absent means
70
+ * false: a product that is not offline-only
71
+ *
72
+ * @generated from protobuf field: bool forOfflineSaleOnly = 9
73
+ */
74
+ forOfflineSaleOnly: boolean;
66
75
  }
67
76
  declare class Product$Type extends MessageType<Product> {
68
77
  constructor();