@juo/blocks 2.0.0-alpha.5 → 2.0.0-alpha.6

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 (54) hide show
  1. package/dist/{ExtensionRoot-DRpD5EcC.js → ExtensionRoot-CG9dH98z.js} +1 -1
  2. package/dist/core.js +172 -11
  3. package/dist/{css-runtime-B7tZrBIp.js → css-runtime-CjZl0K48.js} +23 -17
  4. package/dist/editor/handler.d.ts.map +1 -1
  5. package/dist/editor.js +4 -1
  6. package/dist/{gridstack-adapter-BGKGC-eO.js → gridstack-adapter-C1Q8gbsH.js} +2 -2
  7. package/dist/languages.d.ts +51 -0
  8. package/dist/languages.d.ts.map +1 -0
  9. package/dist/main.d.ts +1 -0
  10. package/dist/main.d.ts.map +1 -1
  11. package/dist/{project-gridstack-PxN_DIfP.js → project-gridstack-CRZ_7HoT.js} +1 -1
  12. package/dist/services/customer/adapter.d.ts +12 -0
  13. package/dist/services/customer/adapter.d.ts.map +1 -1
  14. package/dist/services/customer/adapter.test.d.ts +2 -0
  15. package/dist/services/customer/adapter.test.d.ts.map +1 -0
  16. package/dist/services/customer/customerService.d.ts.map +1 -1
  17. package/dist/services/customer/index.d.ts +1 -1
  18. package/dist/services/customer/index.d.ts.map +1 -1
  19. package/dist/services/customer/types.d.ts +13 -0
  20. package/dist/services/customer/types.d.ts.map +1 -1
  21. package/dist/services/login/adapter.d.ts.map +1 -1
  22. package/dist/services/login/loginService.d.ts +1 -0
  23. package/dist/services/login/loginService.d.ts.map +1 -1
  24. package/dist/services/login/loginService.test.d.ts +2 -0
  25. package/dist/services/login/loginService.test.d.ts.map +1 -0
  26. package/dist/services/subscription/adapter.d.ts +10 -1
  27. package/dist/services/subscription/adapter.d.ts.map +1 -1
  28. package/dist/services/subscription/index.d.ts +2 -0
  29. package/dist/services/subscription/index.d.ts.map +1 -1
  30. package/dist/services/subscription/instantOrderErrors.d.ts +66 -0
  31. package/dist/services/subscription/instantOrderErrors.d.ts.map +1 -0
  32. package/dist/services/subscription/lineRemoval.d.ts +56 -0
  33. package/dist/services/subscription/lineRemoval.d.ts.map +1 -0
  34. package/dist/services/subscription/lineRemoval.test.d.ts +2 -0
  35. package/dist/services/subscription/lineRemoval.test.d.ts.map +1 -0
  36. package/dist/services/subscription/paymentInstrument.d.ts +8 -1
  37. package/dist/services/subscription/paymentInstrument.d.ts.map +1 -1
  38. package/dist/services/subscription/subscriptionService.d.ts.map +1 -1
  39. package/dist/services/subscription/types.d.ts +87 -1
  40. package/dist/services/subscription/types.d.ts.map +1 -1
  41. package/dist/theme-state.d.ts +10 -1
  42. package/dist/theme-state.d.ts.map +1 -1
  43. package/dist/utils/index.d.ts +7 -0
  44. package/dist/utils/index.d.ts.map +1 -1
  45. package/dist/vue/context.d.ts +25 -1
  46. package/dist/vue/context.d.ts.map +1 -1
  47. package/dist/vue/useTranslatedProp.test.d.ts +2 -0
  48. package/dist/vue/useTranslatedProp.test.d.ts.map +1 -0
  49. package/dist/vue.js +36 -2
  50. package/dist/web-components/editor/InlineText.d.ts +1 -0
  51. package/dist/web-components/editor/InlineText.d.ts.map +1 -1
  52. package/dist/web-components-editor.js +13 -5
  53. package/dist/web-components-runtime.js +2 -2
  54. package/package.json +1 -1
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
4
4
  import { signal, effect, createBlockInstance, layoutSystemEnabled, untracked } from "@juo/blocks";
5
5
  import { reportBlockWarning, reportBlockError } from "./observability.js";
6
6
  import { b as isStubDefinition, w as withWrapper, s as subscribeContext, c as backfillInstanceDefaults, d as __clearDevtoolsBlockState, o as onRegisterBlock } from "./block-BjJztStr.js";
7
- import { L as LAYOUT_SCOPE_ATTR, b as buildGridLayout, a as ThemeStateContext } from "./css-runtime-B7tZrBIp.js";
7
+ import { L as LAYOUT_SCOPE_ATTR, b as buildGridLayout, a as ThemeStateContext } from "./css-runtime-CjZl0K48.js";
8
8
  import { getHook } from "./devtools.js";
9
9
  class Block extends HTMLElement {
10
10
  constructor() {
package/dist/core.js CHANGED
@@ -3,12 +3,33 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import { e as createContext, f as d, m as w, n as defineBlock, h as createBlockInstance, j as getDefinedBlocks, p as registerBlock, E, u, s as subscribeContext } from "./block-BjJztStr.js";
5
5
  import { B, q, t, S, v, _, x, c, y, g, z, A, D, F, G, i, H, b, I, o, J, k, K, l, L, w as w2 } from "./block-BjJztStr.js";
6
- import { G as GRID_V1_ENGINE_ID, d as clampRect, e as applyFillExpansion, f as compactItems, g as findFreeRect, D as DEFAULT_GRID } from "./css-runtime-B7tZrBIp.js";
7
- import { h, i as i2, L as L2, P, a, T, b as b2, j, k as k2, l as l2, m, n, o as o2, p, q as q2, s, t as t2, u as u2, v as v2, c as c2, w as w3, r } from "./css-runtime-B7tZrBIp.js";
6
+ import { G as GRID_V1_ENGINE_ID, d as clampRect, e as applyFillExpansion, f as compactItems, g as findFreeRect, D as DEFAULT_GRID } from "./css-runtime-CjZl0K48.js";
7
+ import { h, i as i2, L as L2, P, a, T, b as b2, j, k as k2, l as l2, m, n, o as o2, p, q as q2, s, t as t2, u as u2, v as v2, c as c2, w as w3, r } from "./css-runtime-CjZl0K48.js";
8
8
  import { reportBlockWarning, reportBlockError } from "./observability.js";
9
9
  import { a as createEditorBridge, E as createSelectBlockMessage } from "./bridge-Mz0CqG6E.js";
10
- import { p as p2 } from "./project-gridstack-PxN_DIfP.js";
10
+ import { p as p2 } from "./project-gridstack-CRZ_7HoT.js";
11
11
  import { clearLayoutModeAdapter, getLayoutModeAdapter, registerLayoutModeAdapter } from "./layout-mode-adapter-BBd4JRQd.js";
12
+ const SUPPORTED_UI_LANGUAGES = [
13
+ { code: "cs", label: "Czech" },
14
+ { code: "da", label: "Danish" },
15
+ { code: "nl", label: "Dutch" },
16
+ { code: "en", label: "English" },
17
+ { code: "fr", label: "French" },
18
+ { code: "de", label: "German" },
19
+ { code: "el", label: "Greek" },
20
+ { code: "hu", label: "Hungarian" },
21
+ { code: "pl", label: "Polish" },
22
+ { code: "pt", label: "Portuguese" },
23
+ { code: "sk", label: "Slovak" },
24
+ { code: "sl", label: "Slovenian" },
25
+ { code: "es", label: "Spanish" }
26
+ ];
27
+ function toLanguageSelectOptions(languages) {
28
+ return languages.map(({ code, label }) => ({ label, value: code }));
29
+ }
30
+ const SUPPORTED_UI_LANGUAGE_OPTIONS = toLanguageSelectOptions(
31
+ SUPPORTED_UI_LANGUAGES
32
+ );
12
33
  function createState() {
13
34
  const discountCode = d(null);
14
35
  const products = d([]);
@@ -276,6 +297,13 @@ function createCustomerService(options) {
276
297
  },
277
298
  createPaymentMethod(params) {
278
299
  return options.adapter.createPaymentMethod(params);
300
+ },
301
+ async updateAttributes(attributes) {
302
+ var _a;
303
+ const merged = { ...(_a = current.value) == null ? void 0 : _a.attributes, ...attributes };
304
+ const result = await options.adapter.updateAttributes(merged);
305
+ if (result._tag === "Success") current.value = result.data;
306
+ return result;
279
307
  }
280
308
  };
281
309
  }
@@ -287,7 +315,8 @@ const PAYMENT_INSTRUMENT_TYPES = [
287
315
  "sepa_direct_debit",
288
316
  "blik",
289
317
  "mbway",
290
- "bacs"
318
+ "bacs",
319
+ "manual"
291
320
  ];
292
321
  const INSTRUMENT_TYPE_TO_NAME = {
293
322
  credit_card: null,
@@ -296,7 +325,8 @@ const INSTRUMENT_TYPE_TO_NAME = {
296
325
  sepa_direct_debit: "SEPA",
297
326
  mbway: "MB WAY",
298
327
  shop_pay: "Shop Pay",
299
- bacs: "Bacs"
328
+ bacs: "Bacs",
329
+ manual: "Shopify Checkout"
300
330
  };
301
331
  function getPaymentInstrumentName(instrument) {
302
332
  const name = INSTRUMENT_TYPE_TO_NAME[instrument.type] ?? null;
@@ -378,16 +408,23 @@ function serializeV1PaymentInstrument(raw) {
378
408
  return { type: "mbway", ...r2.phone != null ? { phone: r2.phone } : {} };
379
409
  case "bacs":
380
410
  return { type: "bacs", maskedNumber: r2.maskedNumber ?? "" };
411
+ case "manual":
412
+ return { type: "manual" };
381
413
  default:
382
414
  return null;
383
415
  }
384
416
  }
385
417
  function createMockCustomerAdapter() {
386
- const customer = { id: "customer-1", name: "Customer 1" };
418
+ let customer = { id: "customer-1", name: "Customer 1", attributes: {} };
387
419
  return {
388
420
  async getCurrent() {
389
421
  return { _tag: "Success", data: customer };
390
422
  },
423
+ async updateAttributes(attributes) {
424
+ await new Promise((resolve) => setTimeout(resolve, 300));
425
+ customer = { ...customer, attributes: { ...attributes } };
426
+ return { _tag: "Success", data: customer };
427
+ },
391
428
  async createPaymentMethod(params) {
392
429
  await new Promise((resolve) => setTimeout(resolve, 300));
393
430
  if (params.provider === "shopify") {
@@ -410,17 +447,41 @@ function createMockCustomerAdapter() {
410
447
  }
411
448
  };
412
449
  }
450
+ function fromV1Customer(body) {
451
+ return {
452
+ id: body.id,
453
+ name: body.displayName,
454
+ email: body.email ?? void 0,
455
+ attributes: Object.fromEntries(
456
+ body.customAttributes.map(({ key, value }) => [key, value])
457
+ )
458
+ };
459
+ }
413
460
  function createApiCustomerAdapter(fetcher) {
414
461
  return {
415
462
  async getCurrent() {
416
463
  try {
417
- const res = await fetcher("/customer/info");
464
+ const res = await fetcher("/customer/v1/customer");
465
+ if (!res.ok) return { _tag: "Failure", error: `HTTP ${res.status}` };
466
+ return {
467
+ _tag: "Success",
468
+ data: fromV1Customer(await res.json())
469
+ };
470
+ } catch (e) {
471
+ return { _tag: "Failure", error: e };
472
+ }
473
+ },
474
+ async updateAttributes(attributes) {
475
+ try {
476
+ const res = await fetcher("/customer/v1/customer", {
477
+ method: "PATCH",
478
+ headers: { "Content-Type": "application/json" },
479
+ body: JSON.stringify({ customAttributes: attributes })
480
+ });
418
481
  if (!res.ok) return { _tag: "Failure", error: `HTTP ${res.status}` };
419
- const data = await res.json();
420
- const name = [data.firstName, data.lastName].filter(Boolean).join(" ") || data.email || "";
421
482
  return {
422
483
  _tag: "Success",
423
- data: { id: data.id, name, email: data.email }
484
+ data: fromV1Customer(await res.json())
424
485
  };
425
486
  } catch (e) {
426
487
  return { _tag: "Failure", error: e };
@@ -578,6 +639,12 @@ function createApiLoginAdapter(fetcher, opts) {
578
639
  });
579
640
  }
580
641
  }
642
+ if (res.status === 401) {
643
+ const data = await res.json().catch(() => null);
644
+ if (data != null && typeof data === "object" && "message" in data && data.message === "Customer not found") {
645
+ throw new AuthenticationError(AuthenticationErrorReason.Missing);
646
+ }
647
+ }
581
648
  if (!res.ok) {
582
649
  throw new Error(`Unexpected response: ${res.statusText}`);
583
650
  }
@@ -3816,10 +3883,98 @@ function createSubscriptionService(adapter) {
3816
3883
  getAvailablePlans: (subscriptionId) => adapter.getAvailablePlans({ subscriptionId }),
3817
3884
  getDefaultSubscriptionId: () => adapter.getDefaultSubscriptionId(),
3818
3885
  getUpsellProducts: (params) => adapter.getUpsellProducts ? adapter.getUpsellProducts(params) : Promise.resolve({ _tag: "Success", data: [] }),
3819
- addUpsellProduct: (params) => adapter.addUpsellProduct ? adapter.addUpsellProduct(params) : Promise.resolve({ _tag: "Success", data: void 0 })
3886
+ addUpsellProduct: (params) => adapter.addUpsellProduct ? adapter.addUpsellProduct(params) : Promise.resolve({ _tag: "Success", data: void 0 }),
3887
+ getInstantOrderProducts: (subscriptionId, params) => adapter.getInstantOrderProducts ? adapter.getInstantOrderProducts({ subscriptionId, ...params }) : Promise.resolve({
3888
+ _tag: "Success",
3889
+ data: {
3890
+ available: false,
3891
+ requiresCheckout: false,
3892
+ products: [],
3893
+ hasNextPage: false,
3894
+ endCursor: null
3895
+ }
3896
+ }),
3897
+ placeInstantOrder: (subscriptionId, requestKey, items) => adapter.placeInstantOrder ? adapter.placeInstantOrder({ subscriptionId, requestKey, items }) : (
3898
+ // Distinguishable from every server-side refusal, so a consumer can
3899
+ // treat "this host cannot do instant orders" as a missing capability
3900
+ // rather than telling the customer their order was declined.
3901
+ Promise.resolve({
3902
+ _tag: "Failure",
3903
+ error: { kind: "UNSUPPORTED" }
3904
+ })
3905
+ )
3820
3906
  };
3821
3907
  return service;
3822
3908
  }
3909
+ function isOneTimeLine(line) {
3910
+ return line.isOneTime === true || line.recurringCycleLimit === 1;
3911
+ }
3912
+ function hasValue(value) {
3913
+ return typeof value === "string" && value.length > 0;
3914
+ }
3915
+ function hasIdentity(line) {
3916
+ return hasValue(line.subscriptionId) && hasValue(line.subscriptionLineId);
3917
+ }
3918
+ function isSameLine(a2, b3) {
3919
+ return hasValue(a2.subscriptionLineId) && a2.subscriptionLineId === b3.subscriptionLineId;
3920
+ }
3921
+ function belongsToSameSubscription(a2, b3) {
3922
+ return hasValue(a2.subscriptionId) && a2.subscriptionId === b3.subscriptionId;
3923
+ }
3924
+ function parentLineFor(child, lines) {
3925
+ if (!hasValue(child.parentLineId)) {
3926
+ return void 0;
3927
+ }
3928
+ return lines.find(
3929
+ (candidate) => belongsToSameSubscription(candidate, child) && (candidate.subscriptionLineId === child.parentLineId || candidate.id === child.parentLineId)
3930
+ );
3931
+ }
3932
+ function productKey(line, lines) {
3933
+ if (hasValue(line.parentProductId)) {
3934
+ return `product:${line.parentProductId}`;
3935
+ }
3936
+ if (hasValue(line.parentLineId)) {
3937
+ const parent = parentLineFor(line, lines);
3938
+ if (hasValue(parent == null ? void 0 : parent.productId)) {
3939
+ return `product:${parent.productId}`;
3940
+ }
3941
+ return `line:${line.parentLineId}`;
3942
+ }
3943
+ const lineIdentity = hasValue(line.subscriptionLineId) ? line.subscriptionLineId : line.id;
3944
+ if (!hasValue(lineIdentity)) {
3945
+ return null;
3946
+ }
3947
+ const isReferencedAsParent = lines.some(
3948
+ (candidate) => belongsToSameSubscription(candidate, line) && (hasValue(line.productId) && candidate.parentProductId === line.productId || hasValue(candidate.parentLineId) && (candidate.parentLineId === line.subscriptionLineId || candidate.parentLineId === line.id))
3949
+ );
3950
+ if (isReferencedAsParent && hasValue(line.productId)) {
3951
+ return `product:${line.productId}`;
3952
+ }
3953
+ return `line:${lineIdentity}`;
3954
+ }
3955
+ function remainingRecurringProductKeys(line, lines) {
3956
+ const removedProductKey = productKey(line, lines);
3957
+ return new Set(
3958
+ lines.filter(
3959
+ (item) => belongsToSameSubscription(item, line) && !isOneTimeLine(item)
3960
+ ).map((item) => productKey(item, lines)).filter((key) => key != null && key !== removedProductKey)
3961
+ );
3962
+ }
3963
+ function canRemoveLine(line, lines) {
3964
+ if (!hasIdentity(line)) {
3965
+ return false;
3966
+ }
3967
+ const targetExists = lines.some(
3968
+ (item) => belongsToSameSubscription(item, line) && isSameLine(item, line)
3969
+ );
3970
+ if (!targetExists) {
3971
+ return false;
3972
+ }
3973
+ if (isOneTimeLine(line)) {
3974
+ return true;
3975
+ }
3976
+ return remainingRecurringProductKeys(line, lines).size > 0;
3977
+ }
3823
3978
  function getDefaultBlockForAction(actionType, actionConfig, blockId) {
3824
3979
  const blockName = `action:${actionType}`;
3825
3980
  const definedBlocks = getDefinedBlocks();
@@ -4798,6 +4953,8 @@ export {
4798
4953
  PAYMENT_INSTRUMENT_TYPES,
4799
4954
  ProductServiceContext,
4800
4955
  RouterServiceContext,
4956
+ SUPPORTED_UI_LANGUAGES,
4957
+ SUPPORTED_UI_LANGUAGE_OPTIONS,
4801
4958
  SchedulesServiceContext,
4802
4959
  S as SelectedBlockContext,
4803
4960
  SettingsServiceContext,
@@ -4814,6 +4971,7 @@ export {
4814
4971
  c as backfillInstanceDefaults,
4815
4972
  b2 as buildGridLayout,
4816
4973
  j as buildLayoutCss,
4974
+ canRemoveLine,
4817
4975
  canvasMode,
4818
4976
  clampRect,
4819
4977
  k2 as classifyRowDividers,
@@ -4867,6 +5025,7 @@ export {
4867
5025
  emitLayoutSetRects,
4868
5026
  q2 as expandFillLayoutDocument,
4869
5027
  findFreeRect,
5028
+ fromV1Customer,
4870
5029
  getActiveSurfaceContext,
4871
5030
  getDefaultBlockForAction,
4872
5031
  getDefinedBlocks,
@@ -4884,6 +5043,7 @@ export {
4884
5043
  insertRectRelative,
4885
5044
  H as isEditorPreview,
4886
5045
  isFilterQuery,
5046
+ isOneTimeLine,
4887
5047
  isStaleSubscriptionMessage,
4888
5048
  b as isStubDefinition,
4889
5049
  t2 as layoutScopeSelector,
@@ -4910,6 +5070,7 @@ export {
4910
5070
  l as setLayoutSystemEnabled,
4911
5071
  d as signal,
4912
5072
  subscribeContext,
5073
+ toLanguageSelectOptions,
4913
5074
  L as untracked,
4914
5075
  waitForDevBlocksUrl,
4915
5076
  w2 as withWrapper
@@ -51,12 +51,16 @@ function parseBlockLocaleFile(file) {
51
51
  }
52
52
  };
53
53
  }
54
- function indexOverrides(overrides) {
54
+ function indexOverrides(overrides, locale) {
55
55
  const indexed = {
56
56
  theme: {},
57
57
  blocks: {}
58
58
  };
59
+ const wanted = locale == null ? null : normalizeLocale(locale);
59
60
  for (const item of overrides) {
61
+ if (wanted != null && normalizeLocale(item.locale) !== wanted) {
62
+ continue;
63
+ }
60
64
  if (item.scope.kind === "theme") {
61
65
  indexed.theme[item.key] = item.value;
62
66
  continue;
@@ -122,29 +126,31 @@ function createThemeState(deps) {
122
126
  }
123
127
  return { defaults: nextDefaults, modes: nextModes };
124
128
  }
129
+ let localeVersion = 0;
125
130
  async function setLocale(nextLocaleRaw) {
126
131
  var _a2;
127
132
  const nextLocale = normalizeLocale(nextLocaleRaw);
133
+ const version = ++localeVersion;
128
134
  const [blockData, loadedOverrides] = await Promise.all([
129
135
  collectBlockDefaults(nextLocale),
130
136
  ((_a2 = deps.translations) == null ? void 0 : _a2.resolveTranslations(nextLocale).catch(() => [])) ?? Promise.resolve([])
131
137
  ]);
132
- const overrides = loadedOverrides.filter(
133
- (item) => normalizeLocale(item.locale) === nextLocale
134
- );
135
- const indexed = indexOverrides(overrides);
136
- catalogs.value = {
137
- theme: {
138
- defaults: {},
139
- overrides: indexed.theme
140
- },
141
- blocks: {
142
- defaults: blockData.defaults,
143
- modes: blockData.modes,
144
- overrides: indexed.blocks
145
- }
146
- };
147
- locale.value = nextLocale;
138
+ if (version !== localeVersion) return;
139
+ const indexed = indexOverrides(loadedOverrides, nextLocale);
140
+ r(() => {
141
+ catalogs.value = {
142
+ theme: {
143
+ defaults: {},
144
+ overrides: indexed.theme
145
+ },
146
+ blocks: {
147
+ defaults: blockData.defaults,
148
+ modes: blockData.modes,
149
+ overrides: indexed.blocks
150
+ }
151
+ };
152
+ locale.value = nextLocale;
153
+ });
148
154
  }
149
155
  async function resolve(surface, path, params) {
150
156
  var _a2, _b, _c, _d, _e, _f, _g, _h;
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/editor/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAKL,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,UAAU,CAAC;IACvB,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACrD;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB;6BAsE/B,aAAa;EAgU9C"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/editor/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAKL,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,UAAU,CAAC;IACvB,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACrD;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB;6BAsE/B,aAAa;EA0U9C"}
package/dist/editor.js CHANGED
@@ -82,7 +82,10 @@ function createEditorHandler(options) {
82
82
  const catalogs = themeState.locales.catalogs;
83
83
  const current = catalogs.value;
84
84
  if (current == null) return;
85
- const indexed = indexOverrides(message.payload.overrides);
85
+ const indexed = indexOverrides(
86
+ message.payload.overrides,
87
+ themeState.locales.locale.value
88
+ );
86
89
  catalogs.value = {
87
90
  ...current,
88
91
  theme: {
@@ -1,5 +1,5 @@
1
- import { c as reconcileLayout, L as LAYOUT_SCOPE_ATTR, M as MAX_BLOCKS_PER_ROW } from "./css-runtime-B7tZrBIp.js";
2
- import { r as resolveActiveBreakpoint, p as projectToGridStack, M as MIN_BLOCK_ROWS, a as MIN_BLOCK_PX } from "./project-gridstack-PxN_DIfP.js";
1
+ import { c as reconcileLayout, L as LAYOUT_SCOPE_ATTR, M as MAX_BLOCKS_PER_ROW } from "./css-runtime-CjZl0K48.js";
2
+ import { r as resolveActiveBreakpoint, p as projectToGridStack, M as MIN_BLOCK_ROWS, a as MIN_BLOCK_PX } from "./project-gridstack-CRZ_7HoT.js";
3
3
  import { LAYOUT_POP_CLASS, LAYOUT_INTERACTION_START, LAYOUT_INTERACTION_END } from "./layout-mode-adapter-BBd4JRQd.js";
4
4
  function obsolete(self, f, oldName, newName, rev) {
5
5
  const wrapper = (...args) => {
@@ -0,0 +1,51 @@
1
+ export declare const SUPPORTED_UI_LANGUAGES: readonly [{
2
+ readonly code: "cs";
3
+ readonly label: "Czech";
4
+ }, {
5
+ readonly code: "da";
6
+ readonly label: "Danish";
7
+ }, {
8
+ readonly code: "nl";
9
+ readonly label: "Dutch";
10
+ }, {
11
+ readonly code: "en";
12
+ readonly label: "English";
13
+ }, {
14
+ readonly code: "fr";
15
+ readonly label: "French";
16
+ }, {
17
+ readonly code: "de";
18
+ readonly label: "German";
19
+ }, {
20
+ readonly code: "el";
21
+ readonly label: "Greek";
22
+ }, {
23
+ readonly code: "hu";
24
+ readonly label: "Hungarian";
25
+ }, {
26
+ readonly code: "pl";
27
+ readonly label: "Polish";
28
+ }, {
29
+ readonly code: "pt";
30
+ readonly label: "Portuguese";
31
+ }, {
32
+ readonly code: "sk";
33
+ readonly label: "Slovak";
34
+ }, {
35
+ readonly code: "sl";
36
+ readonly label: "Slovenian";
37
+ }, {
38
+ readonly code: "es";
39
+ readonly label: "Spanish";
40
+ }];
41
+ export type SupportedLanguageCode = (typeof SUPPORTED_UI_LANGUAGES)[number]["code"];
42
+ export type LanguageSelectOption = {
43
+ label: string;
44
+ value: SupportedLanguageCode;
45
+ };
46
+ export declare function toLanguageSelectOptions(languages: readonly {
47
+ code: SupportedLanguageCode;
48
+ label: string;
49
+ }[]): LanguageSelectOption[];
50
+ export declare const SUPPORTED_UI_LANGUAGE_OPTIONS: LanguageSelectOption[];
51
+ //# sourceMappingURL=languages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../src/languages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAczB,CAAC;AAOX,MAAM,MAAM,qBAAqB,GAC/B,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,qBAAqB,CAAC;CAC9B,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,GACnE,oBAAoB,EAAE,CAExB;AAED,eAAO,MAAM,6BAA6B,wBAEzC,CAAC"}
package/dist/main.d.ts CHANGED
@@ -2,6 +2,7 @@ export type { Block, BlockInstance, BlockDefinition, BlockLocaleFile, BlockRende
2
2
  export { attachEmptyTracking, backfillInstanceDefaults, createBlockInstance, createBlockInstanceFromJSON, createBlockInstanceFromObject, createCeRenderer, defineBlock, defineBlockRuntime, getDefinedBlocks, hasRenderedContent, isStubDefinition, withWrapper, registerBlock, SelectedBlockContext, createSelectedBlock, BlockWrapperEvent, serializeBlocks, onRegisterBlock, getDevtoolsBlockState, setDevtoolsBlockProp, __recordDevtoolsInstance, __recordDevtoolsPropSetter, } from './block';
3
3
  export { ThemeStateContext, createThemeState, indexOverrides, type TranslationCatalogs, type TranslationMode, type TranslationScope, type TranslationOverride, type ThemeLocaleState, type ThemeState, type ThemeSurface, type ThemeSurfaceState, type GlobalStyles, type GlobalStyleColors, type ThemeType, type LayoutEngine, DEFAULT_GLOBAL_STYLES, } from './theme-state';
4
4
  export { TranslationContext, createTranslationService, type TranslationServiceOptions, type TranslationService, } from './translation';
5
+ export { SUPPORTED_UI_LANGUAGES, SUPPORTED_UI_LANGUAGE_OPTIONS, toLanguageSelectOptions, type LanguageSelectOption, type SupportedLanguageCode, } from './languages';
5
6
  export { ContextRequestEvent, ContextProvideEvent, type ContextCallback, createContext, injectContext, provideContext, subscribeContext, type ContextType, type UnknownContext, } from './context';
6
7
  export { StateContext, createState } from './state';
7
8
  export { defineOverlayWrapper, type OverlayLayout } from './overlay-wrapper';
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC3B,6BAA6B,EAC7B,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,iBAAiB,EACjB,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AA+B,CAAC;AACvC,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,0BAA0B,EAC1B,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,GACxB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,GACV,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC3B,6BAA6B,EAC7B,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,w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AAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,GACxB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,GACV,MAAM,sBAAsB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { r as resolveLayout } from "./css-runtime-B7tZrBIp.js";
1
+ import { r as resolveLayout } from "./css-runtime-CjZl0K48.js";
2
2
  const MIN_BLOCK_ROWS = 2;
3
3
  const MIN_BLOCK_PX = 200;
4
4
  function resolveActiveBreakpoint(doc, containerWidthPx) {
@@ -3,7 +3,19 @@ import { ApiFetcher, Result } from '../../utils';
3
3
  export interface CustomerAdapter {
4
4
  getCurrent(): Promise<Result<Customer | null>>;
5
5
  createPaymentMethod(params: CreatePaymentMethodParams): Promise<Result<CreatePaymentMethodOutcome>>;
6
+ updateAttributes(attributes: Record<string, string>): Promise<Result<Customer>>;
6
7
  }
7
8
  export declare function createMockCustomerAdapter(): CustomerAdapter;
9
+ export type V1CustomerBody = {
10
+ id: string;
11
+ displayName: string;
12
+ email?: string | null;
13
+ customAttributes: {
14
+ key: string;
15
+ value: string;
16
+ }[];
17
+ };
18
+ /** Maps a `GET/PATCH /customer/v1/customer` response body to the blocks `Customer`. */
19
+ export declare function fromV1Customer(body: V1CustomerBody): Customer;
8
20
  export declare function createApiCustomerAdapter(fetcher: ApiFetcher): CustomerAdapter;
9
21
  //# sourceMappingURL=adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/customer/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAC/F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGtD,MAAM,WAAW,eAAe;IAC9B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ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eAAe,CAkE7E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=adapter.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.test.d.ts","sourceRoot":"","sources":["../../../src/services/customer/adapter.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"customerService.d.ts","sourceRoot":"","sources":["../../../src/services/customer/customerService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,SAAS,CAAC;AAEzD,KAAK,4BAA4B,GAAG;IAClC,OAAO,EAAE,eAAe,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,MAAM,CAAC;CACnC,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,eAAe,CAgBjB;AAED,eAAO,MAAM,sBAAsB;;CACkB,CAAC"}
1
+ {"version":3,"file":"customerService.d.ts","sourceRoot":"","sources":["../../../src/services/customer/customerService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,SAAS,CAAC;AAEzD,KAAK,4BAA4B,GAAG;IAClC,OAAO,EAAE,eAAe,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,MAAM,CAAC;CACnC,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,eAAe,CA0BjB;AAED,eAAO,MAAM,sBAAsB;;CACkB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export { type CustomerService, type Customer, type CreatePaymentMethodParams, type CreatePaymentMethodOutcome } from './types';
2
2
  export { createCustomerService, CustomerServiceContext, } from './customerService';
3
- export { type CustomerAdapter, createMockCustomerAdapter, createApiCustomerAdapter, } from './adapter';
3
+ export { type CustomerAdapter, type V1CustomerBody, createMockCustomerAdapter, createApiCustomerAdapter, fromV1Customer, } from './adapter';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/customer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,KAAK,yBAAyB,EAAE,KAAK,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAC/H,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,eAAe,EACpB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/customer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,KAAK,yBAAyB,EAAE,KAAK,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAC/H,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,cAAc,GACf,MAAM,WAAW,CAAC"}
@@ -7,6 +7,8 @@ export type Customer = {
7
7
  name: string;
8
8
  email?: string;
9
9
  metadata?: Record<string, unknown>;
10
+ /** Customer-visible custom attributes (e.g. `date_of_birth`), keyed by attribute key. */
11
+ attributes?: Record<string, string>;
10
12
  };
11
13
  export type CreatePaymentMethodParams = {
12
14
  provider: "shopify";
@@ -26,6 +28,17 @@ export type CustomerService = {
26
28
  current: Signal<Customer | null>;
27
29
  getCurrent(): Promise<Result<Customer | null>>;
28
30
  createPaymentMethod(params: CreatePaymentMethodParams): Promise<Result<CreatePaymentMethodOutcome>>;
31
+ /**
32
+ * Sets the given customer-visible custom attributes, merged with the attributes already known
33
+ * on `current` — other blocks' attributes are preserved, so no block needs to know about every
34
+ * other attribute key in use. Internal (`_`-prefixed) and reserved keys are preserved
35
+ * server-side and rejected with a Failure when written. Updates `current` with the returned
36
+ * customer on success.
37
+ *
38
+ * Note: the underlying adapter/API call REPLACES the entire visible attribute set (there is no
39
+ * per-key clear); this merge happens in `createCustomerService`, not in the adapter.
40
+ */
41
+ updateAttributes(attributes: Record<string, string>): Promise<Result<Customer>>;
29
42
  accountOrdersUrl: Signal<string>;
30
43
  };
31
44
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/customer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAEvF,oFAAoF;AACpF,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GACjC;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,GACvB;IAAE,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzD,MAAM,MAAM,0BAA0B,GAClC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,eAAe,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,6BAA6B,CAAA;CAAE,GAC3F;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,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I,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7B,YAAY,CAwBd;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC3C,YAAY,CAoId"}
@@ -27,6 +27,7 @@ interface ShopService {
27
27
  export type ErrorFormatter = (error: unknown | AuthenticationError) => {
28
28
  title: string;
29
29
  message: string;
30
+ reason?: AuthenticationErrorReason;
30
31
  };
31
32
  export interface LoginServiceDependencies {
32
33
  adapter: LoginAdapter;
@@ -1 +1 @@
1
- {"version":3,"file":"loginService.d.ts","sourceRoot":"","sources":["../../../src/services/login/loginService.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4B,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAKxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9C,oBAAY,yBAAyB;IACnC,OAAO,YAAY;IACnB,aAAa,eAAe;IAC5B,YAAY,mBAAmB;IAC/B,OAAO,aAAa;IACpB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,MAAM,EAAE,yBAAyB,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAG5B,MAAM,EAAE,yBAAyB,EACjC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMjC;AAED,UAAU,aAAa;IACrB,IAAI,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,IAAI,CAAC;IACtE,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,UAAU,WAAW;IACnB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB;AA0BD,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,KAAK;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,YAAY,CAAC;IACtB,WAAW,EAAE,cAAc,CAAC;IAC5B,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE,WAAW,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IACjC,WAAW,EAAE,cAAc,CAAC;IAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;;;;;;;;;;;;;;;;EAmBA;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,wBAAwB;;;;;;;;;;;;;;;;EA+MhE"}
1
+ {"version":3,"file":"loginService.d.ts","sourceRoot":"","sources":["../../../src/services/login/loginService.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4B,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAKxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9C,oBAAY,yBAAyB;IACnC,OAAO,YAAY;IACnB,aAAa,eAAe;IAC5B,YAAY,mBAAmB;IAC/B,OAAO,aAAa;IACpB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,MAAM,EAAE,yBAAyB,CAAC;IAClC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,kBAAkB,CAAC,IAAI,EAAE,wBAAwB;;;;;;;;;;;;;;;;EA+MhE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=loginService.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loginService.test.d.ts","sourceRoot":"","sources":["../../../src/services/login/loginService.test.ts"],"names":[],"mappings":""}
@@ -1,6 +1,7 @@
1
1
  import { ApiFetcher, PaginatedList, Result } from '../../utils';
2
- import { Subscription, SellingPlan, SellingPlanInterval, SearchOptions, PostableSubscriptionItem, UpdateSubscriptionItem, UpdateBoxItem, LastOrder, RenewNowResult, UpsellProduct, UpdateDeliveryAddress, UpdateDeliveryAddressError, UpdateDeliveryMethodError, ShippingMethodOption } from './types';
2
+ import { Subscription, SellingPlan, SellingPlanInterval, SearchOptions, PostableSubscriptionItem, UpdateSubscriptionItem, UpdateBoxItem, LastOrder, RenewNowResult, UpsellProduct, UpdateDeliveryAddress, UpdateDeliveryAddressError, UpdateDeliveryMethodError, ShippingMethodOption, InstantOrderProducts, InstantOrderProductsQuery, InstantOrderPlacement } from './types';
3
3
  import { ApplyDiscountError, DiscountRejectionReason, RemoveDiscountError } from './discountErrors';
4
+ import { InstantOrderProductsError, PlaceInstantOrderError } from './instantOrderErrors';
4
5
  import { ProductAdapter } from '../product/adapter';
5
6
  /**
6
7
  * Adapter interface for subscription.
@@ -150,6 +151,14 @@ export interface SubscriptionAdapter {
150
151
  quantity: number;
151
152
  oneTime?: boolean;
152
153
  }): Promise<Result>;
154
+ getInstantOrderProducts?(params: {
155
+ subscriptionId: string;
156
+ } & InstantOrderProductsQuery): Promise<Result<InstantOrderProducts, InstantOrderProductsError>>;
157
+ placeInstantOrder?(params: {
158
+ subscriptionId: string;
159
+ requestKey: string;
160
+ items: PostableSubscriptionItem[];
161
+ }): Promise<Result<InstantOrderPlacement, PlaceInstantOrderError>>;
153
162
  }
154
163
  export interface MockSubscriptionAdapterOptions {
155
164
  addDiscountBehavior?: {