@firfi/voila-sdk 0.1.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 (155) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +165 -0
  3. package/dist/src/domain/cart.d.ts +10 -0
  4. package/dist/src/domain/cart.d.ts.map +1 -0
  5. package/dist/src/domain/cart.js +14 -0
  6. package/dist/src/domain/cart.js.map +1 -0
  7. package/dist/src/domain/checkout-readiness.d.ts +3 -0
  8. package/dist/src/domain/checkout-readiness.d.ts.map +1 -0
  9. package/dist/src/domain/checkout-readiness.js +18 -0
  10. package/dist/src/domain/checkout-readiness.js.map +1 -0
  11. package/dist/src/domain/parse.d.ts +5 -0
  12. package/dist/src/domain/parse.d.ts.map +1 -0
  13. package/dist/src/domain/parse.js +11 -0
  14. package/dist/src/domain/parse.js.map +1 -0
  15. package/dist/src/domain/schemas/auth.d.ts +123 -0
  16. package/dist/src/domain/schemas/auth.d.ts.map +1 -0
  17. package/dist/src/domain/schemas/auth.js +36 -0
  18. package/dist/src/domain/schemas/auth.js.map +1 -0
  19. package/dist/src/domain/schemas/cart.d.ts +1224 -0
  20. package/dist/src/domain/schemas/cart.d.ts.map +1 -0
  21. package/dist/src/domain/schemas/cart.js +123 -0
  22. package/dist/src/domain/schemas/cart.js.map +1 -0
  23. package/dist/src/domain/schemas/category-page.d.ts +187 -0
  24. package/dist/src/domain/schemas/category-page.d.ts.map +1 -0
  25. package/dist/src/domain/schemas/category-page.js +43 -0
  26. package/dist/src/domain/schemas/category-page.js.map +1 -0
  27. package/dist/src/domain/schemas/category.d.ts +25 -0
  28. package/dist/src/domain/schemas/category.d.ts.map +1 -0
  29. package/dist/src/domain/schemas/category.js +30 -0
  30. package/dist/src/domain/schemas/category.js.map +1 -0
  31. package/dist/src/domain/schemas/checkout-summary.d.ts +1035 -0
  32. package/dist/src/domain/schemas/checkout-summary.d.ts.map +1 -0
  33. package/dist/src/domain/schemas/checkout-summary.js +103 -0
  34. package/dist/src/domain/schemas/checkout-summary.js.map +1 -0
  35. package/dist/src/domain/schemas/delivery-destination.d.ts +176 -0
  36. package/dist/src/domain/schemas/delivery-destination.d.ts.map +1 -0
  37. package/dist/src/domain/schemas/delivery-destination.js +52 -0
  38. package/dist/src/domain/schemas/delivery-destination.js.map +1 -0
  39. package/dist/src/domain/schemas/index.d.ts +13 -0
  40. package/dist/src/domain/schemas/index.d.ts.map +1 -0
  41. package/dist/src/domain/schemas/index.js +13 -0
  42. package/dist/src/domain/schemas/index.js.map +1 -0
  43. package/dist/src/domain/schemas/money.d.ts +18 -0
  44. package/dist/src/domain/schemas/money.d.ts.map +1 -0
  45. package/dist/src/domain/schemas/money.js +11 -0
  46. package/dist/src/domain/schemas/money.js.map +1 -0
  47. package/dist/src/domain/schemas/product.d.ts +230 -0
  48. package/dist/src/domain/schemas/product.d.ts.map +1 -0
  49. package/dist/src/domain/schemas/product.js +32 -0
  50. package/dist/src/domain/schemas/product.js.map +1 -0
  51. package/dist/src/domain/schemas/proposition.d.ts +746 -0
  52. package/dist/src/domain/schemas/proposition.d.ts.map +1 -0
  53. package/dist/src/domain/schemas/proposition.js +110 -0
  54. package/dist/src/domain/schemas/proposition.js.map +1 -0
  55. package/dist/src/domain/schemas/search.d.ts +31 -0
  56. package/dist/src/domain/schemas/search.d.ts.map +1 -0
  57. package/dist/src/domain/schemas/search.js +16 -0
  58. package/dist/src/domain/schemas/search.js.map +1 -0
  59. package/dist/src/domain/schemas/session.d.ts +1341 -0
  60. package/dist/src/domain/schemas/session.d.ts.map +1 -0
  61. package/dist/src/domain/schemas/session.js +140 -0
  62. package/dist/src/domain/schemas/session.js.map +1 -0
  63. package/dist/src/domain/schemas/slot.d.ts +844 -0
  64. package/dist/src/domain/schemas/slot.d.ts.map +1 -0
  65. package/dist/src/domain/schemas/slot.js +130 -0
  66. package/dist/src/domain/schemas/slot.js.map +1 -0
  67. package/dist/src/index.d.ts +26 -0
  68. package/dist/src/index.d.ts.map +1 -0
  69. package/dist/src/index.js +26 -0
  70. package/dist/src/index.js.map +1 -0
  71. package/dist/src/voila/browser-login-adapter.d.ts +108 -0
  72. package/dist/src/voila/browser-login-adapter.d.ts.map +1 -0
  73. package/dist/src/voila/browser-login-adapter.js +128 -0
  74. package/dist/src/voila/browser-login-adapter.js.map +1 -0
  75. package/dist/src/voila/browser-login.d.ts +32 -0
  76. package/dist/src/voila/browser-login.d.ts.map +1 -0
  77. package/dist/src/voila/browser-login.js +86 -0
  78. package/dist/src/voila/browser-login.js.map +1 -0
  79. package/dist/src/voila/cart-mutation.d.ts +23 -0
  80. package/dist/src/voila/cart-mutation.d.ts.map +1 -0
  81. package/dist/src/voila/cart-mutation.js +52 -0
  82. package/dist/src/voila/cart-mutation.js.map +1 -0
  83. package/dist/src/voila/cart-view.d.ts +14 -0
  84. package/dist/src/voila/cart-view.d.ts.map +1 -0
  85. package/dist/src/voila/cart-view.js +45 -0
  86. package/dist/src/voila/cart-view.js.map +1 -0
  87. package/dist/src/voila/catalog-search.d.ts +27 -0
  88. package/dist/src/voila/catalog-search.d.ts.map +1 -0
  89. package/dist/src/voila/catalog-search.js +40 -0
  90. package/dist/src/voila/catalog-search.js.map +1 -0
  91. package/dist/src/voila/categories.d.ts +4 -0
  92. package/dist/src/voila/categories.d.ts.map +1 -0
  93. package/dist/src/voila/categories.js +22 -0
  94. package/dist/src/voila/categories.js.map +1 -0
  95. package/dist/src/voila/category-products.d.ts +22 -0
  96. package/dist/src/voila/category-products.d.ts.map +1 -0
  97. package/dist/src/voila/category-products.js +32 -0
  98. package/dist/src/voila/category-products.js.map +1 -0
  99. package/dist/src/voila/checkout-summary.d.ts +15 -0
  100. package/dist/src/voila/checkout-summary.d.ts.map +1 -0
  101. package/dist/src/voila/checkout-summary.js +93 -0
  102. package/dist/src/voila/checkout-summary.js.map +1 -0
  103. package/dist/src/voila/checkout-urls.d.ts +11 -0
  104. package/dist/src/voila/checkout-urls.d.ts.map +1 -0
  105. package/dist/src/voila/checkout-urls.js +23 -0
  106. package/dist/src/voila/checkout-urls.js.map +1 -0
  107. package/dist/src/voila/delivery-destinations.d.ts +22 -0
  108. package/dist/src/voila/delivery-destinations.d.ts.map +1 -0
  109. package/dist/src/voila/delivery-destinations.js +70 -0
  110. package/dist/src/voila/delivery-destinations.js.map +1 -0
  111. package/dist/src/voila/guest-bootstrap.d.ts +40 -0
  112. package/dist/src/voila/guest-bootstrap.d.ts.map +1 -0
  113. package/dist/src/voila/guest-bootstrap.js +108 -0
  114. package/dist/src/voila/guest-bootstrap.js.map +1 -0
  115. package/dist/src/voila/headers.d.ts +5 -0
  116. package/dist/src/voila/headers.d.ts.map +1 -0
  117. package/dist/src/voila/headers.js +20 -0
  118. package/dist/src/voila/headers.js.map +1 -0
  119. package/dist/src/voila/http-client.d.ts +60 -0
  120. package/dist/src/voila/http-client.d.ts.map +1 -0
  121. package/dist/src/voila/http-client.js +124 -0
  122. package/dist/src/voila/http-client.js.map +1 -0
  123. package/dist/src/voila/initial-state.d.ts +19 -0
  124. package/dist/src/voila/initial-state.d.ts.map +1 -0
  125. package/dist/src/voila/initial-state.js +117 -0
  126. package/dist/src/voila/initial-state.js.map +1 -0
  127. package/dist/src/voila/session-health.d.ts +10 -0
  128. package/dist/src/voila/session-health.d.ts.map +1 -0
  129. package/dist/src/voila/session-health.js +176 -0
  130. package/dist/src/voila/session-health.js.map +1 -0
  131. package/dist/src/voila/session-snapshot.d.ts +41 -0
  132. package/dist/src/voila/session-snapshot.d.ts.map +1 -0
  133. package/dist/src/voila/session-snapshot.js +101 -0
  134. package/dist/src/voila/session-snapshot.js.map +1 -0
  135. package/dist/src/voila/session-storage.d.ts +22 -0
  136. package/dist/src/voila/session-storage.d.ts.map +1 -0
  137. package/dist/src/voila/session-storage.js +54 -0
  138. package/dist/src/voila/session-storage.js.map +1 -0
  139. package/dist/src/voila/shopping-context.d.ts +33 -0
  140. package/dist/src/voila/shopping-context.d.ts.map +1 -0
  141. package/dist/src/voila/shopping-context.js +159 -0
  142. package/dist/src/voila/shopping-context.js.map +1 -0
  143. package/dist/src/voila/slot-urls.d.ts +22 -0
  144. package/dist/src/voila/slot-urls.d.ts.map +1 -0
  145. package/dist/src/voila/slot-urls.js +51 -0
  146. package/dist/src/voila/slot-urls.js.map +1 -0
  147. package/dist/src/voila/slots.d.ts +41 -0
  148. package/dist/src/voila/slots.d.ts.map +1 -0
  149. package/dist/src/voila/slots.js +137 -0
  150. package/dist/src/voila/slots.js.map +1 -0
  151. package/dist/src/voila/urls.d.ts +114 -0
  152. package/dist/src/voila/urls.d.ts.map +1 -0
  153. package/dist/src/voila/urls.js +197 -0
  154. package/dist/src/voila/urls.js.map +1 -0
  155. package/package.json +66 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../../../src/domain/schemas/slot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAY/B,eAAO,MAAM,8BAA8B,gDAA+C,CAAA;AAE1F,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,8BAA8B,CAAC,CAAA;AAEhG,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;EAWjC,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAEhF,eAAO,MAAM,gBAAgB;;;;;;;;;;SAK5B,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEpE,eAAO,MAAM,4BAA4B;;;;;;;;;;SAKxC,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAE5F,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAEpG,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ1C,CAAA;AAEF,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,+BAA+B,CAAC,CAAA"}
@@ -0,0 +1,130 @@
1
+ import { Schema } from "effect";
2
+ import { MoneySchema } from "./money.js";
3
+ const UnknownStringRecordSchema = Schema.Record({ key: Schema.String, value: Schema.Unknown });
4
+ const NonEmptyStringSchema = Schema.String.pipe(Schema.trimmed(), Schema.minLength(1));
5
+ const PositiveIntegerSchema = Schema.Number.pipe(Schema.finite(), Schema.int(), Schema.positive());
6
+ export const SlotDisplayConfigurationSchema = Schema.Literal("CARRIER", "DELIVERY_METHOD");
7
+ export const SlotListingInputSchema = Schema.Struct({
8
+ deliveryDestinationId: NonEmptyStringSchema,
9
+ displayConfiguration: Schema.optionalWith(SlotDisplayConfigurationSchema, {
10
+ default: () => "DELIVERY_METHOD"
11
+ }),
12
+ numberOfDays: Schema.optionalWith(PositiveIntegerSchema, { exact: true }),
13
+ pageViewId: Schema.optionalWith(NonEmptyStringSchema, { exact: true }),
14
+ regionId: NonEmptyStringSchema,
15
+ sessionId: Schema.optionalWith(NonEmptyStringSchema, { exact: true }),
16
+ shippingGroupType: NonEmptyStringSchema,
17
+ viewingLocation: Schema.optionalWith(NonEmptyStringSchema, { exact: true })
18
+ });
19
+ export const SlotWindowSchema = Schema.asSchema(Schema.Struct({
20
+ endTime: Schema.String,
21
+ startTime: Schema.String
22
+ }).pipe(Schema.extend(UnknownStringRecordSchema)));
23
+ export const OnDemandSlotPropertiesSchema = Schema.asSchema(Schema.Struct({
24
+ collectionTimeInMinutes: Schema.optionalWith(Schema.Number.pipe(Schema.finite()), { exact: true }),
25
+ deliveryTimeInMinutes: Schema.optionalWith(Schema.Number.pipe(Schema.finite()), { exact: true })
26
+ }).pipe(Schema.extend(UnknownStringRecordSchema)));
27
+ export const RawSlotSchema = Schema.asSchema(Schema.Struct({
28
+ attributes: Schema.optionalWith(Schema.Array(Schema.String), { exact: true }),
29
+ deliveryPrice: Schema.optionalWith(MoneySchema, { exact: true }),
30
+ onDemandProperties: Schema.optionalWith(OnDemandSlotPropertiesSchema, { exact: true }),
31
+ slotId: Schema.optionalWith(Schema.String, { exact: true }),
32
+ slotWindow: Schema.optionalWith(SlotWindowSchema, { exact: true }),
33
+ timeZoneId: Schema.optionalWith(Schema.String, { exact: true }),
34
+ title: Schema.optionalWith(Schema.String, { exact: true }),
35
+ type: Schema.optionalWith(Schema.String, { exact: true })
36
+ }).pipe(Schema.extend(UnknownStringRecordSchema)));
37
+ export const RawSlotGridDaySchema = Schema.asSchema(Schema.Struct({
38
+ day: Schema.String,
39
+ slots: Schema.Array(RawSlotSchema)
40
+ }).pipe(Schema.extend(UnknownStringRecordSchema)));
41
+ export const RawSlotDayMappingSchema = Schema.asSchema(Schema.Struct({
42
+ day: Schema.String,
43
+ slotIds: Schema.optionalWith(Schema.Array(Schema.String), { exact: true }),
44
+ slotListingId: Schema.optionalWith(Schema.String, { exact: true })
45
+ }).pipe(Schema.extend(UnknownStringRecordSchema)));
46
+ export const RawSlotCarrierSchema = Schema.asSchema(Schema.Struct({
47
+ carrierDetails: Schema.optionalWith(Schema.Array(Schema.Unknown), { exact: true }),
48
+ carrierId: Schema.optionalWith(Schema.String, { exact: true }),
49
+ carrierName: Schema.optionalWith(Schema.String, { exact: true }),
50
+ daysMapping: Schema.optionalWith(Schema.Array(RawSlotDayMappingSchema), { exact: true }),
51
+ featuredSlots: Schema.optionalWith(Schema.Array(RawSlotSchema), { exact: true }),
52
+ gridSlots: Schema.optionalWith(Schema.Array(RawSlotGridDaySchema), { exact: true }),
53
+ title: Schema.optionalWith(Schema.String, { exact: true })
54
+ }).pipe(Schema.extend(UnknownStringRecordSchema)));
55
+ export const RawSlotListingResponseSchema = Schema.asSchema(Schema.Struct({
56
+ carriers: Schema.Array(RawSlotCarrierSchema),
57
+ days: Schema.optionalWith(Schema.Array(Schema.Struct({
58
+ date: Schema.String
59
+ }).pipe(Schema.extend(UnknownStringRecordSchema))), { exact: true })
60
+ }).pipe(Schema.extend(UnknownStringRecordSchema)));
61
+ export const NormalizedSlotSchema = Schema.Struct({
62
+ attributes: Schema.Array(Schema.String),
63
+ available: Schema.Boolean,
64
+ date: Schema.optionalWith(Schema.String, { exact: true }),
65
+ carrierId: Schema.optionalWith(Schema.String, { exact: true }),
66
+ slotListingId: Schema.optionalWith(Schema.String, { exact: true }),
67
+ slotId: Schema.optionalWith(Schema.String, { exact: true }),
68
+ startTime: Schema.optionalWith(Schema.String, { exact: true }),
69
+ endTime: Schema.optionalWith(Schema.String, { exact: true }),
70
+ type: Schema.optionalWith(Schema.String, { exact: true }),
71
+ title: Schema.optionalWith(Schema.String, { exact: true }),
72
+ timeZoneId: Schema.optionalWith(Schema.String, { exact: true }),
73
+ onDemandProperties: Schema.optionalWith(OnDemandSlotPropertiesSchema, { exact: true }),
74
+ deliveryPrice: Schema.optionalWith(MoneySchema, { exact: true })
75
+ });
76
+ export const NormalizedSlotCarrierSchema = Schema.Struct({
77
+ carrierId: Schema.optionalWith(Schema.String, { exact: true }),
78
+ carrierName: Schema.optionalWith(Schema.String, { exact: true }),
79
+ days: Schema.Array(RawSlotDayMappingSchema),
80
+ title: Schema.optionalWith(Schema.String, { exact: true })
81
+ });
82
+ export const NormalizedSlotListingSchema = Schema.Struct({
83
+ availableSlotCount: Schema.Number.pipe(Schema.finite(), Schema.int(), Schema.nonNegative()),
84
+ carriers: Schema.Array(NormalizedSlotCarrierSchema),
85
+ slots: Schema.Array(NormalizedSlotSchema)
86
+ });
87
+ export const SlotReservationInputSchema = Schema.Struct({
88
+ allowReservationOverwrite: Schema.Literal(true),
89
+ confirmSlotReservation: Schema.Literal(true),
90
+ deliveryDestinationId: NonEmptyStringSchema,
91
+ externalAddress: Schema.optionalWith(UnknownStringRecordSchema, { exact: true }),
92
+ regionId: NonEmptyStringSchema,
93
+ slotId: NonEmptyStringSchema
94
+ });
95
+ export const SlotReservationSelectionInputSchema = Schema.Struct({
96
+ allowReservationOverwrite: Schema.Literal(true),
97
+ confirmSlotReservation: Schema.Literal(true),
98
+ deliveryDestinationId: NonEmptyStringSchema,
99
+ externalAddress: Schema.optionalWith(UnknownStringRecordSchema, { exact: true }),
100
+ regionId: NonEmptyStringSchema,
101
+ slot: NormalizedSlotSchema
102
+ });
103
+ export const ReservedSlotSchema = Schema.asSchema(Schema.Struct({
104
+ expiryTime: Schema.optionalWith(Schema.String, { exact: true }),
105
+ minimumCheckoutThreshold: Schema.optionalWith(MoneySchema, { exact: true }),
106
+ originalMinimumCheckoutThreshold: Schema.optionalWith(MoneySchema, { exact: true }),
107
+ slotId: Schema.optionalWith(Schema.String, { exact: true }),
108
+ timeZoneId: Schema.optionalWith(Schema.String, { exact: true })
109
+ }).pipe(Schema.extend(UnknownStringRecordSchema)));
110
+ export const SlotReservationConfirmationDataSchema = Schema.asSchema(Schema.Struct({
111
+ draftBasketId: Schema.optionalWith(Schema.String, { exact: true }),
112
+ invalidVouchers: Schema.optionalWith(Schema.Array(Schema.Unknown), { exact: true }),
113
+ regionChanged: Schema.optionalWith(Schema.Boolean, { exact: true }),
114
+ slotRegionId: Schema.optionalWith(Schema.String, { exact: true }),
115
+ totalChanged: Schema.optionalWith(Schema.Boolean, { exact: true })
116
+ }).pipe(Schema.extend(UnknownStringRecordSchema)));
117
+ export const RawSlotReservationResponseSchema = Schema.asSchema(Schema.Struct({
118
+ confirmationData: Schema.optionalWith(SlotReservationConfirmationDataSchema, { exact: true }),
119
+ slot: ReservedSlotSchema
120
+ }).pipe(Schema.extend(UnknownStringRecordSchema)));
121
+ export const NormalizedSlotReservationSchema = Schema.Struct({
122
+ confirmationData: Schema.optionalWith(SlotReservationConfirmationDataSchema, { exact: true }),
123
+ expiryTime: Schema.optionalWith(Schema.String, { exact: true }),
124
+ minimumCheckoutThreshold: Schema.optionalWith(MoneySchema, { exact: true }),
125
+ originalMinimumCheckoutThreshold: Schema.optionalWith(MoneySchema, { exact: true }),
126
+ reserved: Schema.Literal(true),
127
+ slotId: Schema.optionalWith(Schema.String, { exact: true }),
128
+ timeZoneId: Schema.optionalWith(Schema.String, { exact: true })
129
+ });
130
+ //# sourceMappingURL=slot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot.js","sourceRoot":"","sources":["../../../../src/domain/schemas/slot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;AAC9F,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;AACtF,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAC9C,MAAM,CAAC,MAAM,EAAE,EACf,MAAM,CAAC,GAAG,EAAE,EACZ,MAAM,CAAC,QAAQ,EAAE,CAClB,CAAA;AAED,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAA;AAI1F,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC;IAClD,qBAAqB,EAAE,oBAAoB;IAC3C,oBAAoB,EAAE,MAAM,CAAC,YAAY,CAAC,8BAA8B,EAAE;QACxE,OAAO,EAAE,GAAG,EAAE,CAAC,iBAA0B;KAC1C,CAAC;IACF,YAAY,EAAE,MAAM,CAAC,YAAY,CA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gB,EAAE,MAAM,CAAC,YAAY,CAAC,qCAAqC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC7F,IAAI,EAAE,kBAAkB;CACzB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,CAClD,CAAA;AAID,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3D,gBAAgB,EAAE,MAAM,CAAC,YAAY,CAAC,qCAAqC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC7F,UAAU,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC/D,wBAAwB,EAAE,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC3E,gCAAgC,EAAE,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACnF,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC3D,UAAU,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;CAChE,CAAC,CAAA"}
@@ -0,0 +1,26 @@
1
+ export * from "./domain/cart.js";
2
+ export * from "./domain/checkout-readiness.js";
3
+ export * from "./domain/parse.js";
4
+ export * from "./domain/schemas/index.js";
5
+ export * from "./voila/browser-login-adapter.js";
6
+ export * from "./voila/browser-login.js";
7
+ export * from "./voila/cart-mutation.js";
8
+ export * from "./voila/cart-view.js";
9
+ export * from "./voila/catalog-search.js";
10
+ export * from "./voila/categories.js";
11
+ export * from "./voila/category-products.js";
12
+ export * from "./voila/checkout-summary.js";
13
+ export * from "./voila/checkout-urls.js";
14
+ export * from "./voila/delivery-destinations.js";
15
+ export * from "./voila/guest-bootstrap.js";
16
+ export * from "./voila/headers.js";
17
+ export * from "./voila/http-client.js";
18
+ export * from "./voila/initial-state.js";
19
+ export * from "./voila/session-health.js";
20
+ export * from "./voila/session-snapshot.js";
21
+ export * from "./voila/session-storage.js";
22
+ export * from "./voila/shopping-context.js";
23
+ export * from "./voila/slot-urls.js";
24
+ export * from "./voila/slots.js";
25
+ export * from "./voila/urls.js";
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0BAA0B,CAAA;AACxC,cAAc,kCAAkC,CAAA;AAChD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,26 @@
1
+ export * from "./domain/cart.js";
2
+ export * from "./domain/checkout-readiness.js";
3
+ export * from "./domain/parse.js";
4
+ export * from "./domain/schemas/index.js";
5
+ export * from "./voila/browser-login-adapter.js";
6
+ export * from "./voila/browser-login.js";
7
+ export * from "./voila/cart-mutation.js";
8
+ export * from "./voila/cart-view.js";
9
+ export * from "./voila/catalog-search.js";
10
+ export * from "./voila/categories.js";
11
+ export * from "./voila/category-products.js";
12
+ export * from "./voila/checkout-summary.js";
13
+ export * from "./voila/checkout-urls.js";
14
+ export * from "./voila/delivery-destinations.js";
15
+ export * from "./voila/guest-bootstrap.js";
16
+ export * from "./voila/headers.js";
17
+ export * from "./voila/http-client.js";
18
+ export * from "./voila/initial-state.js";
19
+ export * from "./voila/session-health.js";
20
+ export * from "./voila/session-snapshot.js";
21
+ export * from "./voila/session-storage.js";
22
+ export * from "./voila/shopping-context.js";
23
+ export * from "./voila/slot-urls.js";
24
+ export * from "./voila/slots.js";
25
+ export * from "./voila/urls.js";
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0BAA0B,CAAA;AACxC,cAAc,kCAAkC,CAAA;AAChD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,108 @@
1
+ import { Either } from "effect";
2
+ import { type BrowserLoginRequest } from "../domain/schemas/index.js";
3
+ import { type CookieJarPort } from "./session-snapshot.js";
4
+ export interface InteractiveBrowserLoginPage {
5
+ readonly close: () => Promise<unknown>;
6
+ readonly openLogin: (request: BrowserLoginRequest) => Promise<unknown>;
7
+ readonly readAccountSummary: () => Promise<unknown>;
8
+ readonly readAuthenticated: () => Promise<unknown>;
9
+ readonly readCookies: (url: string) => Promise<unknown>;
10
+ readonly readInitialState: () => Promise<unknown>;
11
+ readonly waitForLoginCompletion: (request: BrowserLoginRequest) => Promise<unknown>;
12
+ }
13
+ export interface InteractiveBrowserLoginDriver {
14
+ readonly openPage: () => Promise<InteractiveBrowserLoginPage>;
15
+ }
16
+ export declare const createInteractiveBrowserLoginPort: (driver: InteractiveBrowserLoginDriver, cookieJarPort?: CookieJarPort) => {
17
+ captureSession: (request: BrowserLoginRequest) => Promise<Either.Left<{
18
+ readonly message?: string;
19
+ readonly _tag: "BrowserLoginUserCancelled";
20
+ } | {
21
+ readonly message?: string;
22
+ readonly _tag: "BrowserLoginTimedOut";
23
+ } | {
24
+ readonly message?: string;
25
+ readonly _tag: "BrowserLoginAdapterFailure";
26
+ }, undefined> | Either.Left<{
27
+ readonly message?: string;
28
+ readonly _tag: "BrowserLoginUserCancelled";
29
+ } | {
30
+ readonly message?: string;
31
+ readonly _tag: "BrowserLoginTimedOut";
32
+ } | {
33
+ readonly message?: string;
34
+ readonly _tag: "BrowserLoginAdapterFailure";
35
+ }, {
36
+ readonly authenticated: boolean;
37
+ readonly session: {
38
+ readonly cookieJar: {
39
+ readonly cookies: readonly ({
40
+ readonly value?: string;
41
+ readonly key?: string;
42
+ } & {
43
+ readonly [x: string]: unknown;
44
+ })[];
45
+ readonly rejectPublicSuffixes: boolean;
46
+ readonly storeType: string | null;
47
+ readonly version: string;
48
+ } & {
49
+ readonly [x: string]: unknown;
50
+ };
51
+ readonly csrf: {
52
+ readonly token: string;
53
+ };
54
+ readonly metadata: {
55
+ readonly assetVersion: string;
56
+ readonly clientRouteId: string;
57
+ readonly pageViewId: string;
58
+ readonly regionId: string;
59
+ };
60
+ };
61
+ readonly account?: {
62
+ readonly displayName?: string;
63
+ readonly emailHint?: string;
64
+ readonly stableAccountIdHash?: string;
65
+ };
66
+ }> | Either.Right<{
67
+ readonly message?: string;
68
+ readonly _tag: "BrowserLoginUserCancelled";
69
+ } | {
70
+ readonly message?: string;
71
+ readonly _tag: "BrowserLoginTimedOut";
72
+ } | {
73
+ readonly message?: string;
74
+ readonly _tag: "BrowserLoginAdapterFailure";
75
+ }, {
76
+ readonly authenticated: boolean;
77
+ readonly session: {
78
+ readonly cookieJar: {
79
+ readonly cookies: readonly ({
80
+ readonly value?: string;
81
+ readonly key?: string;
82
+ } & {
83
+ readonly [x: string]: unknown;
84
+ })[];
85
+ readonly rejectPublicSuffixes: boolean;
86
+ readonly storeType: string | null;
87
+ readonly version: string;
88
+ } & {
89
+ readonly [x: string]: unknown;
90
+ };
91
+ readonly csrf: {
92
+ readonly token: string;
93
+ };
94
+ readonly metadata: {
95
+ readonly assetVersion: string;
96
+ readonly clientRouteId: string;
97
+ readonly pageViewId: string;
98
+ readonly regionId: string;
99
+ };
100
+ };
101
+ readonly account?: {
102
+ readonly displayName?: string;
103
+ readonly emailHint?: string;
104
+ readonly stableAccountIdHash?: string;
105
+ };
106
+ }>>;
107
+ };
108
+ //# sourceMappingURL=browser-login-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-login-adapter.d.ts","sourceRoot":"","sources":["../../../src/voila/browser-login-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAA;AAGvC,OAAO,EAOL,KAAK,mBAAmB,EAEzB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,KAAK,aAAa,EAA2C,MAAM,uBAAuB,CAAA;AAGnG,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;IACtC,QAAQ,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACtE,QAAQ,CAAC,kBAAkB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;IACnD,QAAQ,CAAC,iBAAiB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;IAClD,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACvD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;IACjD,QAAQ,CAAC,sBAAsB,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CACpF;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,2BAA2B,CAAC,CAAA;CAC9D;AAmID,eAAO,MAAM,iCAAiC,GAC5C,QAAQ,6BAA6B,EACrC,gBAAe,aAAkC;8BAEjB,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDnD,CAAA"}
@@ -0,0 +1,128 @@
1
+ import { Either, Schema } from "effect";
2
+ import { parseUnknown } from "../domain/parse.js";
3
+ import { AuthAccountSummarySchema, BrowserLoginBrowserCookieArraySchema, InitialStateSchema } from "../domain/schemas/index.js";
4
+ import { makeSessionSnapshot, toughCookieJarPort } from "./session-snapshot.js";
5
+ import { VOILA_BASE_URL } from "./urls.js";
6
+ const millisecondsPerSecond = 1000;
7
+ const sessionCookieExpires = -1;
8
+ const adapterFailure = () => ({
9
+ _tag: "BrowserLoginAdapterFailure",
10
+ message: "Browser login adapter failed"
11
+ });
12
+ const normalizeWaitFailure = (error) => {
13
+ const parsedError = parseUnknown(Schema.Union(Schema.Struct({ _tag: Schema.Literal("BrowserLoginTimedOut") }), Schema.Struct({ _tag: Schema.Literal("BrowserLoginUserCancelled") })), error);
14
+ if (Either.isLeft(parsedError)) {
15
+ return adapterFailure();
16
+ }
17
+ return parsedError.right;
18
+ };
19
+ const parseOptionalAccountSummary = (input) => input === undefined
20
+ ? Either.right(undefined)
21
+ : Either.mapLeft(parseUnknown(AuthAccountSummarySchema, input), adapterFailure);
22
+ const makeCookieHeader = (cookie) => {
23
+ const expires = cookie.expires === undefined || cookie.expires === sessionCookieExpires
24
+ ? []
25
+ : [`Expires=${new Date(cookie.expires * millisecondsPerSecond).toUTCString()}`];
26
+ return [
27
+ `${cookie.name}=${cookie.value}`,
28
+ `Domain=${cookie.domain}`,
29
+ `Path=${cookie.path}`,
30
+ ...(cookie.secure === true ? ["Secure"] : []),
31
+ ...(cookie.httpOnly === true ? ["HttpOnly"] : []),
32
+ ...(cookie.sameSite === undefined ? [] : [`SameSite=${cookie.sameSite}`]),
33
+ ...expires
34
+ ].join("; ");
35
+ };
36
+ const storeBrowserCookies = (cookies, cookieJarPort) => {
37
+ const jar = cookieJarPort.create();
38
+ for (const cookie of cookies) {
39
+ try {
40
+ jar.setCookieSync(makeCookieHeader(cookie), VOILA_BASE_URL);
41
+ }
42
+ catch {
43
+ return Either.left(adapterFailure());
44
+ }
45
+ }
46
+ return Either.mapLeft(cookieJarPort.serialize(jar), adapterFailure);
47
+ };
48
+ const closePage = async (page) => {
49
+ try {
50
+ await page.close();
51
+ return Either.right(undefined);
52
+ }
53
+ catch {
54
+ return Either.left(adapterFailure());
55
+ }
56
+ };
57
+ const readBrowserCapture = async (page, cookieJarPort) => {
58
+ const initialState = Either.mapLeft(parseUnknown(InitialStateSchema, await page.readInitialState()), adapterFailure);
59
+ const cookies = Either.mapLeft(parseUnknown(BrowserLoginBrowserCookieArraySchema, await page.readCookies(VOILA_BASE_URL)), adapterFailure);
60
+ const authenticated = Either.mapLeft(parseUnknown(Schema.Boolean, await page.readAuthenticated()), adapterFailure);
61
+ const account = parseOptionalAccountSummary(await page.readAccountSummary());
62
+ if (Either.isLeft(initialState)) {
63
+ return Either.left(initialState.left);
64
+ }
65
+ if (Either.isLeft(cookies)) {
66
+ return Either.left(cookies.left);
67
+ }
68
+ if (Either.isLeft(authenticated)) {
69
+ return Either.left(authenticated.left);
70
+ }
71
+ if (Either.isLeft(account)) {
72
+ return Either.left(account.left);
73
+ }
74
+ const cookieJar = storeBrowserCookies(cookies.right, cookieJarPort);
75
+ if (Either.isLeft(cookieJar)) {
76
+ return Either.left(cookieJar.left);
77
+ }
78
+ return Either.map(Either.mapLeft(makeSessionSnapshot(initialState.right.session.metadata, initialState.right.csrf, cookieJar.right), adapterFailure), (session) => ({
79
+ ...(account.right === undefined ? {} : { account: account.right }),
80
+ authenticated: authenticated.right,
81
+ session
82
+ }));
83
+ };
84
+ export const createInteractiveBrowserLoginPort = (driver, cookieJarPort = toughCookieJarPort) => ({
85
+ captureSession: async (request) => {
86
+ let page;
87
+ try {
88
+ page = await driver.openPage();
89
+ }
90
+ catch {
91
+ return Either.left(adapterFailure());
92
+ }
93
+ try {
94
+ await page.openLogin(request);
95
+ }
96
+ catch {
97
+ const closeResult = await closePage(page);
98
+ return Either.isLeft(closeResult) ? closeResult : Either.left(adapterFailure());
99
+ }
100
+ let waitResult;
101
+ try {
102
+ waitResult = await page.waitForLoginCompletion(request);
103
+ }
104
+ catch {
105
+ const closeResult = await closePage(page);
106
+ return Either.isLeft(closeResult) ? closeResult : Either.left(adapterFailure());
107
+ }
108
+ if (waitResult === undefined || waitResult === null || !Either.isEither(waitResult)) {
109
+ const closeResult = await closePage(page);
110
+ return Either.isLeft(closeResult) ? closeResult : Either.left(adapterFailure());
111
+ }
112
+ if (Either.isLeft(waitResult)) {
113
+ const closeResult = await closePage(page);
114
+ return Either.isLeft(closeResult) ? closeResult : Either.left(normalizeWaitFailure(waitResult.left));
115
+ }
116
+ let capture;
117
+ try {
118
+ capture = await readBrowserCapture(page, cookieJarPort);
119
+ }
120
+ catch {
121
+ const closeResult = await closePage(page);
122
+ return Either.isLeft(closeResult) ? closeResult : Either.left(adapterFailure());
123
+ }
124
+ const closeResult = await closePage(page);
125
+ return Either.isLeft(closeResult) ? closeResult : capture;
126
+ }
127
+ });
128
+ //# sourceMappingURL=browser-login-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-login-adapter.js","sourceRoot":"","sources":["../../../src/voila/browser-login-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAEL,wBAAwB,EAExB,oCAAoC,EAIpC,kBAAkB,EACnB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAsB,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAgB1C,MAAM,qBAAqB,GAAG,IAAI,CAAA;AAClC,MAAM,oBAAoB,GAAG,CAAC,CAAC,CAAA;AAE/B,MAAM,cAAc,GAAG,GAA0B,EAAE,CAAC,CAAC;IACnD,IAAI,EAAE,4BAA4B;IAClC,OAAO,EAAE,8BAA8B;CACxC,CAAC,CAAA;AAEF,MAAM,oBAAoB,GAAG,CAAC,KAAc,EAAyB,EAAE;IACrE,MAAM,WAAW,GAAG,YAAY,CAC9B,MAAM,CAAC,KAAK,CACV,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,CAAC,EAC/D,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,2BAA2B,CAAC,EAAE,C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serLoginRequest } from "../domain/schemas/index.js";
3
+ export interface BrowserLoginPort {
4
+ readonly captureSession: (request: BrowserLoginRequest) => Promise<unknown>;
5
+ }
6
+ export interface BrowserLoginResult {
7
+ readonly session: AuthenticatedSdkSessionSnapshot;
8
+ }
9
+ export type BrowserLoginError = {
10
+ readonly _tag: "BrowserLoginUserCancelled";
11
+ readonly message: string;
12
+ } | {
13
+ readonly _tag: "BrowserLoginTimedOut";
14
+ readonly message: string;
15
+ } | {
16
+ readonly _tag: "BrowserLoginOptionsInvalid";
17
+ readonly message: string;
18
+ } | {
19
+ readonly _tag: "BrowserLoginAdapterFailure";
20
+ readonly message: string;
21
+ } | {
22
+ readonly _tag: "BrowserLoginCaptureInvalid";
23
+ readonly message: string;
24
+ } | {
25
+ readonly _tag: "BrowserLoginMissingCookies";
26
+ readonly message: string;
27
+ } | {
28
+ readonly _tag: "BrowserLoginNotAuthenticated";
29
+ readonly message: string;
30
+ };
31
+ export declare const loginWithBrowser: (browser: BrowserLoginPort, options?: unknown) => Promise<Either.Either<BrowserLoginResult, BrowserLoginError>>;
32
+ //# sourceMappingURL=browser-login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-login.d.ts","sourceRoot":"","sources":["../../../src/voila/browser-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAG/B,OAAO,EACL,KAAK,+BAA+B,EAIpC,KAAK,mBAAmB,EAEzB,MAAM,4BAA4B,CAAA;AAInC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,cAAc,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC5E;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,+BAA+B,CAAA;CAClD;AAED,MAAM,MAAM,iBAAiB,GACzB;IACA,QAAQ,CAAC,IAAI,EAAE,2BAA2B,CAAA;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,GACC;IACA,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAA;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,GACC;IACA,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAA;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,GACC;IACA,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAA;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,GACC;IACA,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAA;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,GACC;IACA,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAA;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,GACC;IACA,QAAQ,CAAC,IAAI,EAAE,8BAA8B,CAAA;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,CAAA;AAwEH,eAAO,MAAM,gBAAgB,GAC3B,SAAS,gBAAgB,EACzB,UAAU,OAAO,KAChB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAiD9D,CAAA"}
@@ -0,0 +1,86 @@
1
+ import { Either } from "effect";
2
+ import { parseUnknown } from "../domain/parse.js";
3
+ import { BrowserLoginCaptureSchema, BrowserLoginOptionsSchema, BrowserLoginPortErrorSchema, BrowserLoginRequestSchema } from "../domain/schemas/index.js";
4
+ import { makeAuthenticatedSdkSessionSnapshot } from "./session-snapshot.js";
5
+ import { VOILA_BASE_URL } from "./urls.js";
6
+ const loginUrl = new URL("/", VOILA_BASE_URL).href;
7
+ const emptyCookieCount = 0;
8
+ const browserLoginOptionsInvalid = () => ({
9
+ _tag: "BrowserLoginOptionsInvalid",
10
+ message: "Browser login options do not match the SDK schema"
11
+ });
12
+ const browserLoginAdapterFailure = () => ({
13
+ _tag: "BrowserLoginAdapterFailure",
14
+ message: "Browser login adapter failed before returning a typed result"
15
+ });
16
+ const browserLoginUserCancelled = () => ({
17
+ _tag: "BrowserLoginUserCancelled",
18
+ message: "User cancelled interactive browser login"
19
+ });
20
+ const browserLoginTimedOut = () => ({
21
+ _tag: "BrowserLoginTimedOut",
22
+ message: "Interactive browser login timed out"
23
+ });
24
+ const browserLoginCaptureInvalid = () => ({
25
+ _tag: "BrowserLoginCaptureInvalid",
26
+ message: "Browser login capture does not match the SDK schema"
27
+ });
28
+ const browserLoginMissingCookies = () => ({
29
+ _tag: "BrowserLoginMissingCookies",
30
+ message: "Browser login completed without Voila session cookies"
31
+ });
32
+ const browserLoginNotAuthenticated = () => ({
33
+ _tag: "BrowserLoginNotAuthenticated",
34
+ message: "Browser login completed without authenticated account evidence"
35
+ });
36
+ const normalizeBrowserLoginPortError = (error) => {
37
+ const parsedError = parseUnknown(BrowserLoginPortErrorSchema, error);
38
+ if (Either.isLeft(parsedError)) {
39
+ return browserLoginAdapterFailure();
40
+ }
41
+ switch (parsedError.right._tag) {
42
+ case "BrowserLoginAdapterFailure":
43
+ return browserLoginAdapterFailure();
44
+ case "BrowserLoginTimedOut":
45
+ return browserLoginTimedOut();
46
+ case "BrowserLoginUserCancelled":
47
+ return browserLoginUserCancelled();
48
+ }
49
+ };
50
+ const makeBrowserLoginRequest = (options) => Either.flatMap(Either.mapLeft(parseUnknown(BrowserLoginOptionsSchema, options ?? {}), browserLoginOptionsInvalid), (parsedOptions) => Either.mapLeft(parseUnknown(BrowserLoginRequestSchema, {
51
+ ...parsedOptions,
52
+ loginUrl
53
+ }), browserLoginOptionsInvalid));
54
+ export const loginWithBrowser = async (browser, options) => {
55
+ const request = makeBrowserLoginRequest(options);
56
+ if (Either.isLeft(request)) {
57
+ return Either.left(request.left);
58
+ }
59
+ let captureResult;
60
+ try {
61
+ captureResult = await browser.captureSession(request.right);
62
+ }
63
+ catch {
64
+ return Either.left(browserLoginAdapterFailure());
65
+ }
66
+ if (captureResult === undefined || captureResult === null || !Either.isEither(captureResult)) {
67
+ return Either.left(browserLoginAdapterFailure());
68
+ }
69
+ if (Either.isLeft(captureResult)) {
70
+ return Either.left(normalizeBrowserLoginPortError(captureResult.left));
71
+ }
72
+ const capture = Either.mapLeft(parseUnknown(BrowserLoginCaptureSchema, captureResult.right), browserLoginCaptureInvalid);
73
+ if (Either.isLeft(capture)) {
74
+ return Either.left(capture.left);
75
+ }
76
+ if (capture.right.session.cookieJar.cookies.length === emptyCookieCount) {
77
+ return Either.left(browserLoginMissingCookies());
78
+ }
79
+ if (!capture.right.authenticated) {
80
+ return Either.left(browserLoginNotAuthenticated());
81
+ }
82
+ return Either.map(Either.mapLeft(makeAuthenticatedSdkSessionSnapshot(capture.right.session, "authenticated", capture.right.account), browserLoginCaptureInvalid), (session) => ({
83
+ session
84
+ }));
85
+ };
86
+ //# sourceMappingURL=browser-login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-login.js","sourceRoot":"","sources":["../../../src/voila/browser-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAEL,yBAAyB,EACzB,yBAAyB,EACzB,2BAA2B,EAE3B,yBAAyB,EAC1B,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAA;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAwC1C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,IAAI,CAAA;AAClD,MAAM,gBAAgB,GAAG,CAAC,CAAA;AAE1B,MAAM,0BAA0B,GAAG,GAAsB,EAAE,CAAC,CAAC;IAC3D,IAAI,EAAE,4BAA4B;IAClC,OAAO,EAAE,mDAAmD;CAC7D,CAAC,CAAA;AAEF,MAAM,0BAA0B,GAAG,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AAa,CAAC,KAAK,CAAC,EAC5D,0BAA0B,CAC3B,CAAA;IAED,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAClC,CAAC;IAED,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,KAAK,gBAAgB,EAAE,CAAC;QACxE,OAAO,MAAM,CAAC,IAAI,CAAC,0BAA0B,EAAE,CAAC,CAAA;IAClD,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QACjC,OAAO,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC,CAAA;IACpD,CAAC;IAED,OAAO,MAAM,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CACZ,mCAAmC,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAClG,0BAA0B,CAC3B,EACD,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACZ,OAAO;KACR,CAAC,CACH,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,23 @@
1
+ import { Either } from "effect";
2
+ import { type CartQuantityDeltaError } from "../domain/cart.js";
3
+ import { type CartUpdateResponse, type NormalizedCartMutationResult, type SessionSnapshot } from "../domain/schemas/index.js";
4
+ import type { VoilaJsonResult, VoilaSdkError, VoilaTransport } from "./http-client.js";
5
+ import type { CookieJarPort } from "./session-snapshot.js";
6
+ import type { CartQuantityRequestError } from "./urls.js";
7
+ export type CartMutationResponseNormalizationError = {
8
+ readonly _tag: "CartMutationResponseSchemaMismatch";
9
+ readonly message: string;
10
+ };
11
+ export type ApplyCartDeltasError = CartQuantityRequestError | VoilaSdkError;
12
+ export type ApplyCartDeltasResult = VoilaJsonResult<NormalizedCartMutationResult>;
13
+ export type CartItemsInputError = {
14
+ readonly _tag: "CartItemsInputInvalid";
15
+ readonly message: string;
16
+ };
17
+ export type CartItemsOperationError = ApplyCartDeltasError | CartItemsInputError | CartQuantityDeltaError;
18
+ export declare const normalizeCartMutationResponse: (response: CartUpdateResponse) => NormalizedCartMutationResult;
19
+ export declare const parseCartMutationResponse: (input: unknown) => Either.Either<NormalizedCartMutationResult, CartMutationResponseNormalizationError>;
20
+ export declare const applyCartDeltas: (session: SessionSnapshot, deltas: unknown, transport: VoilaTransport, cookieJarPort?: CookieJarPort) => Promise<Either.Either<ApplyCartDeltasResult, ApplyCartDeltasError>>;
21
+ export declare const addCartItems: (session: SessionSnapshot, items: unknown, transport: VoilaTransport, cookieJarPort?: CookieJarPort) => Promise<Either.Either<ApplyCartDeltasResult, CartItemsOperationError>>;
22
+ export declare const removeCartItems: (session: SessionSnapshot, items: unknown, transport: VoilaTransport, cookieJarPort?: CookieJarPort) => Promise<Either.Either<ApplyCartDeltasResult, CartItemsOperationError>>;
23
+ //# sourceMappingURL=cart-mutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart-mutation.d.ts","sourceRoot":"","sources":["../../../src/voila/cart-mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAA;AAEvC,OAAO,EAAE,KAAK,sBAAsB,EAA+C,MAAM,mBAAmB,CAAA;AAE5G,OAAO,EAGL,KAAK,kBAAkB,EAEvB,KAAK,4BAA4B,EAEjC,KAAK,eAAe,EACrB,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAGzD,MAAM,MAAM,sCAAsC,GAAG;IACnD,QAAQ,CAAC,IAAI,EAAE,oCAAoC,C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