@bestcheckout/dynamic-component-cli 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/types/index.d.ts CHANGED
@@ -66,9 +66,9 @@ type OfferFixedComponentType = (typeof offerFixedComponentTypes)[number];
66
66
  type CheckoutCoreComponentType = CheckoutFixedComponentType | ThankYouFixedComponentType | OfferFixedComponentType;
67
67
  type CheckoutAddableComponentType = "dynamic" | "announcementBar" | "countdown" | "paymentIcons" | "trustBadges" | "trustpilotReview" | "reviewCard" | "testimonials" | "facebookComments" | "staticContent" | "footer" | "productUpsell" | "shippingInsurance" | "vipClub";
68
68
  type CheckoutComponentType = CheckoutCoreComponentType | CheckoutAddableComponentType;
69
- type CheckoutSlotKey = "headerAbove" | "headerBelow" | "beforeExpressCheckout" | "afterContact" | "afterShippingMethod" | "afterPayment" | "afterCta" | "afterOrderSummary" | "afterPolicyLinks" | "footer";
70
- type ThankYouSlotKey = "thankYouHeaderAbove" | "thankYouBeforeOrderStatus" | "thankYouAfterOrderStatus" | "thankYouAfterOrderDetails" | "thankYouAfterContactUs" | "thankYouAfterOrderSummary" | "thankYouAfterPolicyLinks" | "thankYouFooter";
71
- type OfferSlotKey = "offerHeaderAbove" | "afterOrderConfirmation" | "afterProgress" | "afterOffer" | "afterOfferPolicyLinks";
69
+ type CheckoutSlotKey = "headerAbove" | "afterAnnouncement" | "headerFullWidth" | "headerBelow" | "beforeExpressCheckout" | "beforeContact" | "afterContact" | "afterDelivery" | "afterShippingMethod" | "afterPayment" | "afterCta" | "beforeOrderSummary" | "afterOrderSummary" | "afterPolicyLinks" | "footer" | "afterFooter";
70
+ type ThankYouSlotKey = "thankYouHeaderAbove" | "thankYouAfterAnnouncement" | "thankYouHeaderBelow" | "thankYouBeforeOrderStatus" | "thankYouAfterOrderStatus" | "thankYouAfterOrderDetails" | "thankYouAfterContactUs" | "thankYouBeforeOrderSummary" | "thankYouAfterOrderSummary" | "thankYouBeforePolicyLinks" | "thankYouAfterPolicyLinks" | "thankYouFooter" | "thankYouAfterFooter";
71
+ type OfferSlotKey = "offerHeaderAbove" | "afterOrderConfirmation" | "afterProgress" | "afterOffer" | "offerBeforePolicyLinks" | "afterOfferPolicyLinks";
72
72
  type CheckoutAnySlotKey = CheckoutSlotKey | ThankYouSlotKey | OfferSlotKey;
73
73
  type CheckoutSectionInstance = {
74
74
  id: string;
@@ -186,7 +186,7 @@ type CheckoutDynamicHost = {
186
186
  /** Change the selected secure/payment method through the Host guard. */
187
187
  selectPaymentMethod?(method: string): CheckoutActionResult;
188
188
  /** Reserve a secure form before React/SDK creation. The adapter owns release. */
189
- acquirePaymentMount?(identity: CheckoutInstanceIdentity, method: string): {
189
+ acquirePaymentMount?(identity: CheckoutInstanceIdentity, method: string, kind?: "secure" | "action" | "express"): {
190
190
  render(): ReactNode;
191
191
  validate(): Promise<CheckoutValidationResult>;
192
192
  release(): void;
@@ -330,6 +330,8 @@ type CheckoutExpressPaymentMethod = {
330
330
  appearance?: "shop-pay" | "paypal" | "google-pay" | "apple-pay";
331
331
  };
332
332
  type CheckoutPaymentMethod = {
333
+ /** Secure methods use Host submit; native methods use their mounted SDK action button. */
334
+ submission?: "secure" | "native";
333
335
  id: string;
334
336
  title: string;
335
337
  description?: string;
@@ -354,8 +356,11 @@ type CheckoutPaymentActionRenderProps = {
354
356
  method: CheckoutPaymentMethod;
355
357
  isSubmitting: boolean;
356
358
  };
357
- type CheckoutDeliveryField = "firstName" | "lastName" | "address" | "apartment" | "state" | "stateInput" | "city" | "cityInput" | "zip" | "phone";
358
- type CheckoutDeliveryValues = Record<CheckoutDeliveryField, string> & {
359
+ type CheckoutDeliveryField = "streetName" | "buildingNumber" | "district" | "firstName" | "lastName" | "address" | "apartment" | "state" | "stateInput" | "city" | "cityInput" | "zip" | "phone";
360
+ type CheckoutDeliveryValues = Record<Exclude<CheckoutDeliveryField, "streetName" | "buildingNumber" | "district">, string> & {
361
+ streetName?: string;
362
+ buildingNumber?: string;
363
+ district?: string;
359
364
  country: string;
360
365
  };
361
366
  type CheckoutDeliveryOption = {
@@ -397,11 +402,32 @@ type CheckoutAccount = {
397
402
  email: string;
398
403
  avatar?: string;
399
404
  };
405
+ type CheckoutAddressSchema = Record<"state" | "city" | "zip", {
406
+ visible: boolean;
407
+ required: boolean;
408
+ label: string;
409
+ order: number;
410
+ }>;
400
411
  type CheckoutDeliveryState = {
401
412
  values: CheckoutDeliveryValues;
413
+ /** Actual load failure; Host presents this through Toast. */
414
+ locationError?: string;
415
+ locationStatus?: string;
416
+ retryLocations?: () => void;
402
417
  countryOptions: CheckoutDeliveryOption[];
403
418
  stateOptions: CheckoutDeliveryOption[];
404
419
  cityOptions: CheckoutDeliveryOption[];
420
+ lastNameFirst?: boolean;
421
+ addressLayout?: {
422
+ field: CheckoutDeliveryField;
423
+ label: string;
424
+ required: boolean;
425
+ span?: number;
426
+ placeholder?: string;
427
+ widget?: "select" | "text" | "combobox";
428
+ }[][];
429
+ addressSchema?: CheckoutAddressSchema;
430
+ isAddressComplete?: boolean;
405
431
  useStateSelect: boolean;
406
432
  useCitySelect: boolean;
407
433
  phoneCode?: string;
@@ -416,9 +442,24 @@ type CheckoutDeliveryState = {
416
442
  };
417
443
  type CheckoutBillingState = {
418
444
  values: CheckoutDeliveryValues;
445
+ /** Actual load failure; Host presents this through Toast. */
446
+ locationError?: string;
447
+ locationStatus?: string;
448
+ retryLocations?: () => void;
419
449
  countryOptions: CheckoutDeliveryOption[];
420
450
  stateOptions: CheckoutDeliveryOption[];
421
451
  cityOptions: CheckoutDeliveryOption[];
452
+ lastNameFirst?: boolean;
453
+ addressLayout?: {
454
+ field: CheckoutDeliveryField;
455
+ label: string;
456
+ required: boolean;
457
+ span?: number;
458
+ placeholder?: string;
459
+ widget?: "select" | "text" | "combobox";
460
+ }[][];
461
+ addressSchema?: CheckoutAddressSchema;
462
+ isAddressComplete?: boolean;
422
463
  useStateSelect: boolean;
423
464
  useCitySelect: boolean;
424
465
  phoneCode?: string;
@@ -499,6 +540,7 @@ type CheckoutRuntime = {
499
540
  startExpressCheckout?: (method: string) => void;
500
541
  renderExpressCheckout?: (props: CheckoutExpressCheckoutRenderProps) => ReactNode;
501
542
  renderPaymentDetails?: (props: CheckoutPaymentDetailsRenderProps) => ReactNode;
543
+ renderAdditionalInformation?: () => ReactNode;
502
544
  renderPaymentAction?: (props: CheckoutPaymentActionRenderProps) => ReactNode;
503
545
  setContactEmail?: (email: string) => void;
504
546
  openSignIn?: () => void;
@@ -515,6 +557,12 @@ type CheckoutRuntime = {
515
557
  editSavedAddress?: (addressId: string) => void;
516
558
  deleteSavedAddress?: (addressId: string) => void;
517
559
  applyGoogleDeliveryAddress?: (address: CheckoutGoogleAddress) => void;
560
+ renderBillingPhoneInput?: (props: {
561
+ placeholder: string;
562
+ }) => ReactNode;
563
+ renderDeliveryPhoneInput?: (props: {
564
+ placeholder: string;
565
+ }) => ReactNode;
518
566
  renderDeliveryAddressInput?: (props: CheckoutAddressInputRenderProps) => ReactNode;
519
567
  billing?: CheckoutBillingState;
520
568
  setBillingSameAsShipping?: (sameAsShipping: boolean) => void;
@@ -604,6 +652,11 @@ type CheckoutThankYouSnapshot = {
604
652
  billingAddress?: CheckoutAddress;
605
653
  billingSameAsShipping?: boolean;
606
654
  shippingMethod?: string;
655
+ /** Read-only order-level tax and identity fields supplied by the Storefront. */
656
+ additionalInformation?: Array<{
657
+ title: string;
658
+ value: string;
659
+ }>;
607
660
  payment?: {
608
661
  brand?: string;
609
662
  last4?: string;
@@ -832,11 +885,31 @@ declare function toCheckoutSnapshot(host: CheckoutRuntime, preview?: boolean): {
832
885
  useStateSelect: boolean;
833
886
  useCitySelect: boolean;
834
887
  phoneCode?: string;
888
+ lastNameFirst?: boolean;
889
+ locationError?: string;
890
+ locationStatus?: string;
891
+ isAddressComplete?: boolean | undefined;
835
892
  savedAddressCount?: number | undefined;
836
893
  selectedSavedAddressId?: string | undefined;
837
894
  isSavedAddressListExpanded?: boolean | undefined;
838
895
  isUsingNewAddress?: boolean | undefined;
839
896
  googlePlacesApiKey?: string | undefined;
897
+ addressLayout: Pick<{
898
+ field: CheckoutDeliveryField;
899
+ label: string;
900
+ required: boolean;
901
+ span?: number;
902
+ placeholder?: string;
903
+ widget?: "select" | "text" | "combobox";
904
+ }, "label" | "placeholder" | "required" | "field" | "span" | "widget">[][] | undefined;
905
+ addressSchema: {
906
+ [k: string]: Pick<{
907
+ visible: boolean;
908
+ required: boolean;
909
+ label: string;
910
+ order: number;
911
+ }, "label" | "required" | "visible" | "order">;
912
+ } | undefined;
840
913
  values: CheckoutDeliveryValues;
841
914
  errors: Partial<CheckoutDeliveryValues> | undefined;
842
915
  countryOptions: CheckoutDeliveryOption[];
@@ -847,9 +920,29 @@ declare function toCheckoutSnapshot(host: CheckoutRuntime, preview?: boolean): {
847
920
  useStateSelect: boolean;
848
921
  useCitySelect: boolean;
849
922
  phoneCode?: string;
923
+ lastNameFirst?: boolean;
924
+ locationError?: string;
925
+ locationStatus?: string;
926
+ isAddressComplete?: boolean | undefined;
850
927
  googlePlacesApiKey?: string | undefined;
851
928
  sameAsShipping: boolean;
852
929
  hasShippingAddress: boolean;
930
+ addressLayout: Pick<{
931
+ field: CheckoutDeliveryField;
932
+ label: string;
933
+ required: boolean;
934
+ span?: number;
935
+ placeholder?: string;
936
+ widget?: "select" | "text" | "combobox";
937
+ }, "label" | "placeholder" | "required" | "field" | "span" | "widget">[][] | undefined;
938
+ addressSchema: {
939
+ [k: string]: Pick<{
940
+ visible: boolean;
941
+ required: boolean;
942
+ label: string;
943
+ order: number;
944
+ }, "label" | "required" | "visible" | "order">;
945
+ } | undefined;
853
946
  values: CheckoutDeliveryValues;
854
947
  errors: Partial<CheckoutDeliveryValues> | undefined;
855
948
  countryOptions: CheckoutDeliveryOption[];
@@ -871,7 +964,7 @@ declare function toCheckoutSnapshot(host: CheckoutRuntime, preview?: boolean): {
871
964
  isApplying: boolean | undefined;
872
965
  };
873
966
  payment: {
874
- methods: Pick<CheckoutPaymentMethod, "description" | "title" | "id" | "showCardBrandIcons">[];
967
+ methods: Pick<CheckoutPaymentMethod, "description" | "title" | "id" | "showCardBrandIcons" | "submission">[];
875
968
  selectedMethod: string;
876
969
  isSubmitting: boolean | undefined;
877
970
  expressMethods: Pick<CheckoutExpressPaymentMethod, "label" | "id" | "appearance">[];
@@ -897,11 +990,31 @@ declare function createDynamicCheckoutAdapter(context: DynamicComponentContext,
897
990
  useStateSelect: boolean;
898
991
  useCitySelect: boolean;
899
992
  phoneCode?: string;
993
+ lastNameFirst?: boolean;
994
+ locationError?: string;
995
+ locationStatus?: string;
996
+ isAddressComplete?: boolean | undefined;
900
997
  savedAddressCount?: number | undefined;
901
998
  selectedSavedAddressId?: string | undefined;
902
999
  isSavedAddressListExpanded?: boolean | undefined;
903
1000
  isUsingNewAddress?: boolean | undefined;
904
1001
  googlePlacesApiKey?: string | undefined;
1002
+ addressLayout: Pick<{
1003
+ field: CheckoutDeliveryField;
1004
+ label: string;
1005
+ required: boolean;
1006
+ span?: number;
1007
+ placeholder?: string;
1008
+ widget?: "select" | "text" | "combobox";
1009
+ }, "label" | "placeholder" | "required" | "field" | "span" | "widget">[][] | undefined;
1010
+ addressSchema: {
1011
+ [k: string]: Pick<{
1012
+ visible: boolean;
1013
+ required: boolean;
1014
+ label: string;
1015
+ order: number;
1016
+ }, "label" | "required" | "visible" | "order">;
1017
+ } | undefined;
905
1018
  values: CheckoutDeliveryValues;
906
1019
  errors: Partial<CheckoutDeliveryValues> | undefined;
907
1020
  countryOptions: CheckoutDeliveryOption[];
@@ -912,9 +1025,29 @@ declare function createDynamicCheckoutAdapter(context: DynamicComponentContext,
912
1025
  useStateSelect: boolean;
913
1026
  useCitySelect: boolean;
914
1027
  phoneCode?: string;
1028
+ lastNameFirst?: boolean;
1029
+ locationError?: string;
1030
+ locationStatus?: string;
1031
+ isAddressComplete?: boolean | undefined;
915
1032
  googlePlacesApiKey?: string | undefined;
916
1033
  sameAsShipping: boolean;
917
1034
  hasShippingAddress: boolean;
1035
+ addressLayout: Pick<{
1036
+ field: CheckoutDeliveryField;
1037
+ label: string;
1038
+ required: boolean;
1039
+ span?: number;
1040
+ placeholder?: string;
1041
+ widget?: "select" | "text" | "combobox";
1042
+ }, "label" | "placeholder" | "required" | "field" | "span" | "widget">[][] | undefined;
1043
+ addressSchema: {
1044
+ [k: string]: Pick<{
1045
+ visible: boolean;
1046
+ required: boolean;
1047
+ label: string;
1048
+ order: number;
1049
+ }, "label" | "required" | "visible" | "order">;
1050
+ } | undefined;
918
1051
  values: CheckoutDeliveryValues;
919
1052
  errors: Partial<CheckoutDeliveryValues> | undefined;
920
1053
  countryOptions: CheckoutDeliveryOption[];
@@ -936,7 +1069,7 @@ declare function createDynamicCheckoutAdapter(context: DynamicComponentContext,
936
1069
  isApplying: boolean | undefined;
937
1070
  };
938
1071
  payment: {
939
- methods: Pick<CheckoutPaymentMethod, "description" | "title" | "id" | "showCardBrandIcons">[];
1072
+ methods: Pick<CheckoutPaymentMethod, "description" | "title" | "id" | "showCardBrandIcons" | "submission">[];
940
1073
  selectedMethod: string;
941
1074
  isSubmitting: boolean | undefined;
942
1075
  expressMethods: Pick<CheckoutExpressPaymentMethod, "label" | "id" | "appearance">[];
@@ -986,11 +1119,31 @@ declare function createDynamicCheckoutAdapter(context: DynamicComponentContext,
986
1119
  useStateSelect: boolean;
987
1120
  useCitySelect: boolean;
988
1121
  phoneCode?: string;
1122
+ lastNameFirst?: boolean;
1123
+ locationError?: string;
1124
+ locationStatus?: string;
1125
+ isAddressComplete?: boolean | undefined;
989
1126
  savedAddressCount?: number | undefined;
990
1127
  selectedSavedAddressId?: string | undefined;
991
1128
  isSavedAddressListExpanded?: boolean | undefined;
992
1129
  isUsingNewAddress?: boolean | undefined;
993
1130
  googlePlacesApiKey?: string | undefined;
1131
+ addressLayout: Pick<{
1132
+ field: CheckoutDeliveryField;
1133
+ label: string;
1134
+ required: boolean;
1135
+ span?: number;
1136
+ placeholder?: string;
1137
+ widget?: "select" | "text" | "combobox";
1138
+ }, "label" | "placeholder" | "required" | "field" | "span" | "widget">[][] | undefined;
1139
+ addressSchema: {
1140
+ [k: string]: Pick<{
1141
+ visible: boolean;
1142
+ required: boolean;
1143
+ label: string;
1144
+ order: number;
1145
+ }, "label" | "required" | "visible" | "order">;
1146
+ } | undefined;
994
1147
  values: CheckoutDeliveryValues;
995
1148
  errors: Partial<CheckoutDeliveryValues> | undefined;
996
1149
  countryOptions: CheckoutDeliveryOption[];
@@ -1053,9 +1206,29 @@ declare function createDynamicCheckoutAdapter(context: DynamicComponentContext,
1053
1206
  useStateSelect: boolean;
1054
1207
  useCitySelect: boolean;
1055
1208
  phoneCode?: string;
1209
+ lastNameFirst?: boolean;
1210
+ locationError?: string;
1211
+ locationStatus?: string;
1212
+ isAddressComplete?: boolean | undefined;
1056
1213
  googlePlacesApiKey?: string | undefined;
1057
1214
  sameAsShipping: boolean;
1058
1215
  hasShippingAddress: boolean;
1216
+ addressLayout: Pick<{
1217
+ field: CheckoutDeliveryField;
1218
+ label: string;
1219
+ required: boolean;
1220
+ span?: number;
1221
+ placeholder?: string;
1222
+ widget?: "select" | "text" | "combobox";
1223
+ }, "label" | "placeholder" | "required" | "field" | "span" | "widget">[][] | undefined;
1224
+ addressSchema: {
1225
+ [k: string]: Pick<{
1226
+ visible: boolean;
1227
+ required: boolean;
1228
+ label: string;
1229
+ order: number;
1230
+ }, "label" | "required" | "visible" | "order">;
1231
+ } | undefined;
1059
1232
  values: CheckoutDeliveryValues;
1060
1233
  errors: Partial<CheckoutDeliveryValues> | undefined;
1061
1234
  countryOptions: CheckoutDeliveryOption[];
@@ -1123,7 +1296,7 @@ declare function createDynamicCheckoutAdapter(context: DynamicComponentContext,
1123
1296
  };
1124
1297
  payment: {
1125
1298
  getState: () => {
1126
- methods: Pick<CheckoutPaymentMethod, "description" | "title" | "id" | "showCardBrandIcons">[];
1299
+ methods: Pick<CheckoutPaymentMethod, "description" | "title" | "id" | "showCardBrandIcons" | "submission">[];
1127
1300
  selectedMethod: string;
1128
1301
  isSubmitting: boolean | undefined;
1129
1302
  expressMethods: Pick<CheckoutExpressPaymentMethod, "label" | "id" | "appearance">[];