@hanzo/commerce 7.7.0 → 7.7.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/dist/components/checkout/payment-step-form/methods/card.js +20 -2
- package/dist/components/checkout/payment-step-form/methods/card.js.map +1 -1
- package/package.json +38 -9
- package/billing.ts +0 -2
- package/client.ts +0 -783
- package/components/Icons.tsx +0 -35
- package/components/add-to-cart-widget.tsx +0 -195
- package/components/buy/buy-card.tsx +0 -269
- package/components/buy/carousel-buy-card.tsx +0 -243
- package/components/buy/multi-family/all-variants-carousel.tsx +0 -259
- package/components/buy/multi-family/family-carousel/index.tsx +0 -75
- package/components/buy/multi-family/family-carousel/slide.tsx +0 -82
- package/components/buy/multi-family/family-carousel/state.ts +0 -87
- package/components/buy/multi-family/index.ts +0 -2
- package/components/buy/single-family-selector.tsx +0 -91
- package/components/buy/title-and-byline.tsx +0 -26
- package/components/cart/cart-panel/cart-line-item.tsx +0 -77
- package/components/cart/cart-panel/index.tsx +0 -157
- package/components/cart/cart-panel/promo-code.tsx +0 -105
- package/components/cart/cart-panel/total-area.tsx +0 -61
- package/components/checkout/payment-step-form/card-icon-row.tsx +0 -26
- package/components/checkout/payment-step-form/card-icons/amex.tsx +0 -32
- package/components/checkout/payment-step-form/card-icons/diners-club.tsx +0 -13
- package/components/checkout/payment-step-form/card-icons/discover.tsx +0 -25
- package/components/checkout/payment-step-form/card-icons/jcb.tsx +0 -26
- package/components/checkout/payment-step-form/card-icons/mastercard.tsx +0 -27
- package/components/checkout/payment-step-form/card-icons/visa.tsx +0 -25
- package/components/checkout/payment-step-form/cc-button.tsx +0 -18
- package/components/checkout/payment-step-form/contact-form.tsx +0 -48
- package/components/checkout/payment-step-form/crypto-icons/btc.tsx +0 -11
- package/components/checkout/payment-step-form/crypto-icons/eth.tsx +0 -20
- package/components/checkout/payment-step-form/crypto-icons/usdt.tsx +0 -13
- package/components/checkout/payment-step-form/index.tsx +0 -113
- package/components/checkout/payment-step-form/methods/bank-transfer.tsx +0 -81
- package/components/checkout/payment-step-form/methods/card.tsx +0 -230
- package/components/checkout/payment-step-form/methods/crypto.tsx +0 -226
- package/components/checkout/payment-step-form/methods/index.ts +0 -23
- package/components/checkout/shipping-step-form.tsx +0 -171
- package/components/index.ts +0 -11
- package/components/item/product-card.tsx +0 -66
- package/components/item-selector/button.tsx +0 -213
- package/components/item-selector/carousel/index.tsx +0 -196
- package/components/item-selector/carousel/slider.tsx +0 -37
- package/components/item-selector/index.ts +0 -5
- package/components/item-selector/quantity-indicator.tsx +0 -50
- package/components/node-tabs/index.tsx +0 -90
- package/components/node-tabs/node-image.tsx +0 -31
- package/index.ts +0 -55
- package/metering.test.ts +0 -199
- package/metering.ts +0 -289
- package/product-card.test.tsx +0 -104
- package/service/context.tsx +0 -45
- package/service/debug.ts +0 -41
- package/service/impls/standalone/actual-line-item.ts +0 -136
- package/service/impls/standalone/get-instance.ts +0 -64
- package/service/impls/standalone/index.ts +0 -579
- package/service/impls/standalone/order/firebase.ts +0 -5
- package/service/impls/standalone/order/index.ts +0 -58
- package/service/impls/standalone/persistence.ts +0 -33
- package/service/path-utils.ts +0 -26
- package/service/sep.ts +0 -7
- package/tsconfig.json +0 -17
- package/types/README.md +0 -2
- package/types/category-node.ts +0 -50
- package/types/checkout.ts +0 -47
- package/types/commerce-config.ts +0 -13
- package/types/commerce-service.ts +0 -128
- package/types/family.ts +0 -26
- package/types/index.ts +0 -15
- package/types/item-selector.ts +0 -97
- package/types/line-item.ts +0 -29
- package/types/multi-family-selector-props.ts +0 -20
- package/types/product.ts +0 -21
- package/types/promo.ts +0 -10
- package/types/selection-ui-specifier.ts +0 -52
- package/types/string-mutator.ts +0 -14
- package/types/token-separators.ts +0 -7
- package/util/analytics.ts +0 -21
- package/util/countries.ts +0 -196
- package/util/error.ts +0 -34
- package/util/index.ts +0 -71
- package/util/item-selector-options-accessor.ts +0 -35
- package/util/line-item-ref.ts +0 -23
- package/util/multi-family-selector-options-accessor.ts +0 -15
- package/util/obs-string-mutator.ts +0 -22
- package/util/product-media-accessor.ts +0 -58
- package/util/promo-codes.ts +0 -106
- package/util/selection-ui-specifiers.ts +0 -30
- package/util/square-payment.ts +0 -50
- package/util/use-sync-sku-param-w-current-item.ts +0 -88
package/util/countries.ts
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
//https://stefangabos.github.io/world_countries/
|
|
2
|
-
export default [
|
|
3
|
-
{"id":4,"alpha2":"af","alpha3":"afg","name":"Afghanistan"},
|
|
4
|
-
{"id":8,"alpha2":"al","alpha3":"alb","name":"Albania"},
|
|
5
|
-
{"id":12,"alpha2":"dz","alpha3":"dza","name":"Algeria"},
|
|
6
|
-
{"id":20,"alpha2":"ad","alpha3":"and","name":"Andorra"},
|
|
7
|
-
{"id":24,"alpha2":"ao","alpha3":"ago","name":"Angola"},
|
|
8
|
-
{"id":28,"alpha2":"ag","alpha3":"atg","name":"Antigua and Barbuda"},
|
|
9
|
-
{"id":32,"alpha2":"ar","alpha3":"arg","name":"Argentina"},
|
|
10
|
-
{"id":51,"alpha2":"am","alpha3":"arm","name":"Armenia"},
|
|
11
|
-
{"id":36,"alpha2":"au","alpha3":"aus","name":"Australia"},
|
|
12
|
-
{"id":40,"alpha2":"at","alpha3":"aut","name":"Austria"},
|
|
13
|
-
{"id":31,"alpha2":"az","alpha3":"aze","name":"Azerbaijan"},
|
|
14
|
-
{"id":44,"alpha2":"bs","alpha3":"bhs","name":"Bahamas"},
|
|
15
|
-
{"id":48,"alpha2":"bh","alpha3":"bhr","name":"Bahrain"},
|
|
16
|
-
{"id":50,"alpha2":"bd","alpha3":"bgd","name":"Bangladesh"},
|
|
17
|
-
{"id":52,"alpha2":"bb","alpha3":"brb","name":"Barbados"},
|
|
18
|
-
{"id":112,"alpha2":"by","alpha3":"blr","name":"Belarus"},
|
|
19
|
-
{"id":56,"alpha2":"be","alpha3":"bel","name":"Belgium"},
|
|
20
|
-
{"id":84,"alpha2":"bz","alpha3":"blz","name":"Belize"},
|
|
21
|
-
{"id":204,"alpha2":"bj","alpha3":"ben","name":"Benin"},
|
|
22
|
-
{"id":64,"alpha2":"bt","alpha3":"btn","name":"Bhutan"},
|
|
23
|
-
{"id":68,"alpha2":"bo","alpha3":"bol","name":"Bolivia"},
|
|
24
|
-
{"id":70,"alpha2":"ba","alpha3":"bih","name":"Bosnia and Herzegovina"},
|
|
25
|
-
{"id":72,"alpha2":"bw","alpha3":"bwa","name":"Botswana"},
|
|
26
|
-
{"id":76,"alpha2":"br","alpha3":"bra","name":"Brazil"},
|
|
27
|
-
{"id":96,"alpha2":"bn","alpha3":"brn","name":"Brunei Darussalam"},
|
|
28
|
-
{"id":100,"alpha2":"bg","alpha3":"bgr","name":"Bulgaria"},
|
|
29
|
-
{"id":854,"alpha2":"bf","alpha3":"bfa","name":"Burkina Faso"},
|
|
30
|
-
{"id":108,"alpha2":"bi","alpha3":"bdi","name":"Burundi"},
|
|
31
|
-
{"id":132,"alpha2":"cv","alpha3":"cpv","name":"Cabo Verde"},
|
|
32
|
-
{"id":116,"alpha2":"kh","alpha3":"khm","name":"Cambodia"},
|
|
33
|
-
{"id":120,"alpha2":"cm","alpha3":"cmr","name":"Cameroon"},
|
|
34
|
-
{"id":124,"alpha2":"ca","alpha3":"can","name":"Canada"},
|
|
35
|
-
{"id":140,"alpha2":"cf","alpha3":"caf","name":"Central African Republic"},
|
|
36
|
-
{"id":148,"alpha2":"td","alpha3":"tcd","name":"Chad"},
|
|
37
|
-
{"id":152,"alpha2":"cl","alpha3":"chl","name":"Chile"},
|
|
38
|
-
{"id":156,"alpha2":"cn","alpha3":"chn","name":"China"},
|
|
39
|
-
{"id":170,"alpha2":"co","alpha3":"col","name":"Colombia"},
|
|
40
|
-
{"id":174,"alpha2":"km","alpha3":"com","name":"Comoros"},
|
|
41
|
-
{"id":178,"alpha2":"cg","alpha3":"cog","name":"Congo"},
|
|
42
|
-
{"id":188,"alpha2":"cr","alpha3":"cri","name":"Costa Rica"},
|
|
43
|
-
{"id":384,"alpha2":"ci","alpha3":"civ","name":"Côte d'Ivoire"},
|
|
44
|
-
{"id":191,"alpha2":"hr","alpha3":"hrv","name":"Croatia"},
|
|
45
|
-
{"id":192,"alpha2":"cu","alpha3":"cub","name":"Cuba"},
|
|
46
|
-
{"id":196,"alpha2":"cy","alpha3":"cyp","name":"Cyprus"},
|
|
47
|
-
{"id":203,"alpha2":"cz","alpha3":"cze","name":"Czechia"},
|
|
48
|
-
{"id":180,"alpha2":"cd","alpha3":"cod","name":"Democratic Republic of the Congo"},
|
|
49
|
-
{"id":208,"alpha2":"dk","alpha3":"dnk","name":"Denmark"},
|
|
50
|
-
{"id":262,"alpha2":"dj","alpha3":"dji","name":"Djibouti"},
|
|
51
|
-
{"id":212,"alpha2":"dm","alpha3":"dma","name":"Dominica"},
|
|
52
|
-
{"id":214,"alpha2":"do","alpha3":"dom","name":"Dominican Republic"},
|
|
53
|
-
{"id":218,"alpha2":"ec","alpha3":"ecu","name":"Ecuador"},
|
|
54
|
-
{"id":818,"alpha2":"eg","alpha3":"egy","name":"Egypt"},
|
|
55
|
-
{"id":222,"alpha2":"sv","alpha3":"slv","name":"El Salvador"},
|
|
56
|
-
{"id":226,"alpha2":"gq","alpha3":"gnq","name":"Equatorial Guinea"},
|
|
57
|
-
{"id":232,"alpha2":"er","alpha3":"eri","name":"Eritrea"},
|
|
58
|
-
{"id":233,"alpha2":"ee","alpha3":"est","name":"Estonia"},
|
|
59
|
-
{"id":748,"alpha2":"sz","alpha3":"swz","name":"Eswatini"},
|
|
60
|
-
{"id":231,"alpha2":"et","alpha3":"eth","name":"Ethiopia"},
|
|
61
|
-
{"id":242,"alpha2":"fj","alpha3":"fji","name":"Fiji"},
|
|
62
|
-
{"id":246,"alpha2":"fi","alpha3":"fin","name":"Finland"},
|
|
63
|
-
{"id":250,"alpha2":"fr","alpha3":"fra","name":"France"},
|
|
64
|
-
{"id":266,"alpha2":"ga","alpha3":"gab","name":"Gabon"},
|
|
65
|
-
{"id":270,"alpha2":"gm","alpha3":"gmb","name":"Gambia"},
|
|
66
|
-
{"id":268,"alpha2":"ge","alpha3":"geo","name":"Georgia"},
|
|
67
|
-
{"id":276,"alpha2":"de","alpha3":"deu","name":"Germany"},
|
|
68
|
-
{"id":288,"alpha2":"gh","alpha3":"gha","name":"Ghana"},
|
|
69
|
-
{"id":300,"alpha2":"gr","alpha3":"grc","name":"Greece"},
|
|
70
|
-
{"id":308,"alpha2":"gd","alpha3":"grd","name":"Grenada"},
|
|
71
|
-
{"id":320,"alpha2":"gt","alpha3":"gtm","name":"Guatemala"},
|
|
72
|
-
{"id":324,"alpha2":"gn","alpha3":"gin","name":"Guinea"},
|
|
73
|
-
{"id":624,"alpha2":"gw","alpha3":"gnb","name":"Guinea-Bissau"},
|
|
74
|
-
{"id":328,"alpha2":"gy","alpha3":"guy","name":"Guyana"},
|
|
75
|
-
{"id":332,"alpha2":"ht","alpha3":"hti","name":"Haiti"},
|
|
76
|
-
{"id":340,"alpha2":"hn","alpha3":"hnd","name":"Honduras"},
|
|
77
|
-
{"id":348,"alpha2":"hu","alpha3":"hun","name":"Hungary"},
|
|
78
|
-
{"id":352,"alpha2":"is","alpha3":"isl","name":"Iceland"},
|
|
79
|
-
{"id":356,"alpha2":"in","alpha3":"ind","name":"India"},
|
|
80
|
-
{"id":360,"alpha2":"id","alpha3":"idn","name":"Indonesia"},
|
|
81
|
-
{"id":364,"alpha2":"ir","alpha3":"irn","name":"Iran"},
|
|
82
|
-
{"id":368,"alpha2":"iq","alpha3":"irq","name":"Iraq"},
|
|
83
|
-
{"id":372,"alpha2":"ie","alpha3":"irl","name":"Ireland"},
|
|
84
|
-
{"id":376,"alpha2":"il","alpha3":"isr","name":"Israel"},
|
|
85
|
-
{"id":380,"alpha2":"it","alpha3":"ita","name":"Italy"},
|
|
86
|
-
{"id":388,"alpha2":"jm","alpha3":"jam","name":"Jamaica"},
|
|
87
|
-
{"id":392,"alpha2":"jp","alpha3":"jpn","name":"Japan"},
|
|
88
|
-
{"id":400,"alpha2":"jo","alpha3":"jor","name":"Jordan"},
|
|
89
|
-
{"id":398,"alpha2":"kz","alpha3":"kaz","name":"Kazakhstan"},
|
|
90
|
-
{"id":404,"alpha2":"ke","alpha3":"ken","name":"Kenya"},
|
|
91
|
-
{"id":296,"alpha2":"ki","alpha3":"kir","name":"Kiribati"},
|
|
92
|
-
{"id":414,"alpha2":"kw","alpha3":"kwt","name":"Kuwait"},
|
|
93
|
-
{"id":417,"alpha2":"kg","alpha3":"kgz","name":"Kyrgyzstan"},
|
|
94
|
-
{"id":418,"alpha2":"la","alpha3":"lao","name":"Lao People's Democratic Republic"},
|
|
95
|
-
{"id":428,"alpha2":"lv","alpha3":"lva","name":"Latvia"},
|
|
96
|
-
{"id":422,"alpha2":"lb","alpha3":"lbn","name":"Lebanon"},
|
|
97
|
-
{"id":426,"alpha2":"ls","alpha3":"lso","name":"Lesotho"},
|
|
98
|
-
{"id":430,"alpha2":"lr","alpha3":"lbr","name":"Liberia"},
|
|
99
|
-
{"id":434,"alpha2":"ly","alpha3":"lby","name":"Libya"},
|
|
100
|
-
{"id":438,"alpha2":"li","alpha3":"lie","name":"Liechtenstein"},
|
|
101
|
-
{"id":440,"alpha2":"lt","alpha3":"ltu","name":"Lithuania"},
|
|
102
|
-
{"id":442,"alpha2":"lu","alpha3":"lux","name":"Luxembourg"},
|
|
103
|
-
{"id":450,"alpha2":"mg","alpha3":"mdg","name":"Madagascar"},
|
|
104
|
-
{"id":454,"alpha2":"mw","alpha3":"mwi","name":"Malawi"},
|
|
105
|
-
{"id":458,"alpha2":"my","alpha3":"mys","name":"Malaysia"},
|
|
106
|
-
{"id":462,"alpha2":"mv","alpha3":"mdv","name":"Maldives"},
|
|
107
|
-
{"id":466,"alpha2":"ml","alpha3":"mli","name":"Mali"},
|
|
108
|
-
{"id":470,"alpha2":"mt","alpha3":"mlt","name":"Malta"},
|
|
109
|
-
{"id":584,"alpha2":"mh","alpha3":"mhl","name":"Marshall Islands"},
|
|
110
|
-
{"id":478,"alpha2":"mr","alpha3":"mrt","name":"Mauritania"},
|
|
111
|
-
{"id":480,"alpha2":"mu","alpha3":"mus","name":"Mauritius"},
|
|
112
|
-
{"id":484,"alpha2":"mx","alpha3":"mex","name":"Mexico"},
|
|
113
|
-
{"id":583,"alpha2":"fm","alpha3":"fsm","name":"Micronesia"},
|
|
114
|
-
{"id":498,"alpha2":"md","alpha3":"mda","name":"Moldova"},
|
|
115
|
-
{"id":492,"alpha2":"mc","alpha3":"mco","name":"Monaco"},
|
|
116
|
-
{"id":496,"alpha2":"mn","alpha3":"mng","name":"Mongolia"},
|
|
117
|
-
{"id":499,"alpha2":"me","alpha3":"mne","name":"Montenegro"},
|
|
118
|
-
{"id":504,"alpha2":"ma","alpha3":"mar","name":"Morocco"},
|
|
119
|
-
{"id":508,"alpha2":"mz","alpha3":"moz","name":"Mozambique"},
|
|
120
|
-
{"id":104,"alpha2":"mm","alpha3":"mmr","name":"Myanmar"},
|
|
121
|
-
{"id":516,"alpha2":"na","alpha3":"nam","name":"Namibia"},
|
|
122
|
-
{"id":520,"alpha2":"nr","alpha3":"nru","name":"Nauru"},
|
|
123
|
-
{"id":524,"alpha2":"np","alpha3":"npl","name":"Nepal"},
|
|
124
|
-
{"id":528,"alpha2":"nl","alpha3":"nld","name":"Netherlands"},
|
|
125
|
-
{"id":554,"alpha2":"nz","alpha3":"nzl","name":"New Zealand"},
|
|
126
|
-
{"id":558,"alpha2":"ni","alpha3":"nic","name":"Nicaragua"},
|
|
127
|
-
{"id":562,"alpha2":"ne","alpha3":"ner","name":"Niger"},
|
|
128
|
-
{"id":566,"alpha2":"ng","alpha3":"nga","name":"Nigeria"},
|
|
129
|
-
{"id":408,"alpha2":"kp","alpha3":"prk","name":"North Korea"},
|
|
130
|
-
{"id":807,"alpha2":"mk","alpha3":"mkd","name":"North Macedonia"},
|
|
131
|
-
{"id":578,"alpha2":"no","alpha3":"nor","name":"Norway"},
|
|
132
|
-
{"id":512,"alpha2":"om","alpha3":"omn","name":"Oman"},
|
|
133
|
-
{"id":586,"alpha2":"pk","alpha3":"pak","name":"Pakistan"},
|
|
134
|
-
{"id":585,"alpha2":"pw","alpha3":"plw","name":"Palau"},
|
|
135
|
-
{"id":591,"alpha2":"pa","alpha3":"pan","name":"Panama"},
|
|
136
|
-
{"id":598,"alpha2":"pg","alpha3":"png","name":"Papua New Guinea"},
|
|
137
|
-
{"id":600,"alpha2":"py","alpha3":"pry","name":"Paraguay"},
|
|
138
|
-
{"id":604,"alpha2":"pe","alpha3":"per","name":"Peru"},
|
|
139
|
-
{"id":608,"alpha2":"ph","alpha3":"phl","name":"Philippines"},
|
|
140
|
-
{"id":616,"alpha2":"pl","alpha3":"pol","name":"Poland"},
|
|
141
|
-
{"id":620,"alpha2":"pt","alpha3":"prt","name":"Portugal"},
|
|
142
|
-
{"id":634,"alpha2":"qa","alpha3":"qat","name":"Qatar"},
|
|
143
|
-
{"id":642,"alpha2":"ro","alpha3":"rou","name":"Romania"},
|
|
144
|
-
{"id":643,"alpha2":"ru","alpha3":"rus","name":"Russian Federation"},
|
|
145
|
-
{"id":646,"alpha2":"rw","alpha3":"rwa","name":"Rwanda"},
|
|
146
|
-
{"id":659,"alpha2":"kn","alpha3":"kna","name":"Saint Kitts and Nevis"},
|
|
147
|
-
{"id":662,"alpha2":"lc","alpha3":"lca","name":"Saint Lucia"},
|
|
148
|
-
{"id":670,"alpha2":"vc","alpha3":"vct","name":"Saint Vincent and the Grenadines"},
|
|
149
|
-
{"id":882,"alpha2":"ws","alpha3":"wsm","name":"Samoa"},
|
|
150
|
-
{"id":674,"alpha2":"sm","alpha3":"smr","name":"San Marino"},
|
|
151
|
-
{"id":678,"alpha2":"st","alpha3":"stp","name":"Sao Tome and Principe"},
|
|
152
|
-
{"id":682,"alpha2":"sa","alpha3":"sau","name":"Saudi Arabia"},
|
|
153
|
-
{"id":686,"alpha2":"sn","alpha3":"sen","name":"Senegal"},
|
|
154
|
-
{"id":688,"alpha2":"rs","alpha3":"srb","name":"Serbia"},
|
|
155
|
-
{"id":690,"alpha2":"sc","alpha3":"syc","name":"Seychelles"},
|
|
156
|
-
{"id":694,"alpha2":"sl","alpha3":"sle","name":"Sierra Leone"},
|
|
157
|
-
{"id":702,"alpha2":"sg","alpha3":"sgp","name":"Singapore"},
|
|
158
|
-
{"id":703,"alpha2":"sk","alpha3":"svk","name":"Slovakia"},
|
|
159
|
-
{"id":705,"alpha2":"si","alpha3":"svn","name":"Slovenia"},
|
|
160
|
-
{"id":90,"alpha2":"sb","alpha3":"slb","name":"Solomon Islands"},
|
|
161
|
-
{"id":706,"alpha2":"so","alpha3":"som","name":"Somalia"},
|
|
162
|
-
{"id":710,"alpha2":"za","alpha3":"zaf","name":"South Africa"},
|
|
163
|
-
{"id":410,"alpha2":"kr","alpha3":"kor","name":"South Korea"},
|
|
164
|
-
{"id":728,"alpha2":"ss","alpha3":"ssd","name":"South Sudan"},
|
|
165
|
-
{"id":724,"alpha2":"es","alpha3":"esp","name":"Spain"},
|
|
166
|
-
{"id":144,"alpha2":"lk","alpha3":"lka","name":"Sri Lanka"},
|
|
167
|
-
{"id":729,"alpha2":"sd","alpha3":"sdn","name":"Sudan"},
|
|
168
|
-
{"id":740,"alpha2":"sr","alpha3":"sur","name":"Suriname"},
|
|
169
|
-
{"id":752,"alpha2":"se","alpha3":"swe","name":"Sweden"},
|
|
170
|
-
{"id":756,"alpha2":"ch","alpha3":"che","name":"Switzerland"},
|
|
171
|
-
{"id":760,"alpha2":"sy","alpha3":"syr","name":"Syria"},
|
|
172
|
-
{"id":762,"alpha2":"tj","alpha3":"tjk","name":"Tajikistan"},
|
|
173
|
-
{"id":834,"alpha2":"tz","alpha3":"tza","name":"Tanzania"},
|
|
174
|
-
{"id":764,"alpha2":"th","alpha3":"tha","name":"Thailand"},
|
|
175
|
-
{"id":626,"alpha2":"tl","alpha3":"tls","name":"Timor-Leste"},
|
|
176
|
-
{"id":768,"alpha2":"tg","alpha3":"tgo","name":"Togo"},
|
|
177
|
-
{"id":776,"alpha2":"to","alpha3":"ton","name":"Tonga"},
|
|
178
|
-
{"id":780,"alpha2":"tt","alpha3":"tto","name":"Trinidad and Tobago"},
|
|
179
|
-
{"id":788,"alpha2":"tn","alpha3":"tun","name":"Tunisia"},
|
|
180
|
-
{"id":792,"alpha2":"tr","alpha3":"tur","name":"Türkiye"},
|
|
181
|
-
{"id":795,"alpha2":"tm","alpha3":"tkm","name":"Turkmenistan"},
|
|
182
|
-
{"id":798,"alpha2":"tv","alpha3":"tuv","name":"Tuvalu"},
|
|
183
|
-
{"id":800,"alpha2":"ug","alpha3":"uga","name":"Uganda"},
|
|
184
|
-
{"id":804,"alpha2":"ua","alpha3":"ukr","name":"Ukraine"},
|
|
185
|
-
{"id":784,"alpha2":"ae","alpha3":"are","name":"United Arab Emirates"},
|
|
186
|
-
{"id":826,"alpha2":"gb","alpha3":"gbr","name":"United Kingdom"},
|
|
187
|
-
{"id":840,"alpha2":"us","alpha3":"usa","name":"United States of America"},
|
|
188
|
-
{"id":858,"alpha2":"uy","alpha3":"ury","name":"Uruguay"},
|
|
189
|
-
{"id":860,"alpha2":"uz","alpha3":"uzb","name":"Uzbekistan"},
|
|
190
|
-
{"id":548,"alpha2":"vu","alpha3":"vut","name":"Vanuatu"},
|
|
191
|
-
{"id":862,"alpha2":"ve","alpha3":"ven","name":"Venezuela"},
|
|
192
|
-
{"id":704,"alpha2":"vn","alpha3":"vnm","name":"Viet Nam"},
|
|
193
|
-
{"id":887,"alpha2":"ye","alpha3":"yem","name":"Yemen"},
|
|
194
|
-
{"id":894,"alpha2":"zm","alpha3":"zmb","name":"Zambia"},
|
|
195
|
-
{"id":716,"alpha2":"zw","alpha3":"zwe","name":"Zimbabwe"}
|
|
196
|
-
]
|
package/util/error.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// https://kentcdodds.com/blog/get-a-catch-block-error-message-with-typescript
|
|
3
|
-
|
|
4
|
-
type ErrorWithMessage = {
|
|
5
|
-
message: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const isErrorWithMessage = (error: unknown): error is ErrorWithMessage => {
|
|
9
|
-
return (
|
|
10
|
-
typeof error === 'object' &&
|
|
11
|
-
error !== null &&
|
|
12
|
-
'message' in error &&
|
|
13
|
-
typeof (error as Record<string, unknown>).message === 'string'
|
|
14
|
-
)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const toErrorWithMessage = (maybeError: unknown): ErrorWithMessage => {
|
|
18
|
-
|
|
19
|
-
if (isErrorWithMessage(maybeError)) {
|
|
20
|
-
return maybeError
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
return new Error(JSON.stringify(maybeError))
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
// fallback in case there's an error stringifying the maybeError
|
|
28
|
-
// like with circular references for example.
|
|
29
|
-
return new Error(String(maybeError))
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const getErrorMessage = (error: unknown) => (toErrorWithMessage(error).message)
|
|
34
|
-
|
package/util/index.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { StringMutator, CommerceService } from '../types'
|
|
2
|
-
|
|
3
|
-
export function toTitleCase(str: string) {
|
|
4
|
-
return str.replace(
|
|
5
|
-
/\w\S*/g,
|
|
6
|
-
(txt) => txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase()
|
|
7
|
-
)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function slugify(str: string) {
|
|
11
|
-
return str
|
|
12
|
-
.toLowerCase()
|
|
13
|
-
.replace(/ /g, '-')
|
|
14
|
-
.replace(/[^\w-]+/g, '')
|
|
15
|
-
.replace(/--+/g, '-')
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function unslugify(str: string) {
|
|
19
|
-
return str.replace(/-/g, ' ')
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export function formatCurrencyValue(price: number): string {
|
|
24
|
-
const str = price.toLocaleString('en-US', {
|
|
25
|
-
style: 'currency',
|
|
26
|
-
currency: 'USD',
|
|
27
|
-
});
|
|
28
|
-
return (str.endsWith('.00')) ? str.replace('.00', '') : str
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const getFacetValuesMutator = (level: number, cmmc: CommerceService): StringMutator => {
|
|
32
|
-
|
|
33
|
-
const setLevel = (value: string, level: number ): void => {
|
|
34
|
-
const facets = cmmc.selectedPaths
|
|
35
|
-
facets[level] = [value]
|
|
36
|
-
cmmc.selectPaths(facets)
|
|
37
|
-
const subFacets = cmmc.getSelectedNodesAtLevel(level)
|
|
38
|
-
if (subFacets) {
|
|
39
|
-
const facets = cmmc.selectedPaths
|
|
40
|
-
facets[level + 1] = [subFacets[0].skuToken]
|
|
41
|
-
cmmc.selectPaths(facets)
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const getLevelValueSafe = (level: number): string | null => {
|
|
46
|
-
const facets = cmmc.selectedPaths
|
|
47
|
-
if (!(level in facets) || facets[level].length === 0 ) {
|
|
48
|
-
return null
|
|
49
|
-
}
|
|
50
|
-
return facets[level][0]
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
get: (): string | null => (getLevelValueSafe(level)),
|
|
55
|
-
set: (v: string): void => {setLevel(v, level)}
|
|
56
|
-
} satisfies StringMutator
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export { default as useSyncSkuParamWithCurrentItem } from './use-sync-sku-param-w-current-item'
|
|
60
|
-
export { default as processSquareCardPayment } from './square-payment'
|
|
61
|
-
export { default as ObsStringMutator } from './obs-string-mutator'
|
|
62
|
-
export { default as ProductMediaAccessor } from './product-media-accessor'
|
|
63
|
-
|
|
64
|
-
export * from './selection-ui-specifiers'
|
|
65
|
-
|
|
66
|
-
export { getErrorMessage } from './error'
|
|
67
|
-
|
|
68
|
-
export { default as accessItemOptions } from './item-selector-options-accessor'
|
|
69
|
-
export { default as accessMultiSelectorOptions } from './multi-family-selector-options-accessor'
|
|
70
|
-
|
|
71
|
-
export { default as LineItemRef} from './line-item-ref'
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { ItemSelectorOptions } from '../types'
|
|
2
|
-
|
|
3
|
-
export default (options: ItemSelectorOptions | undefined = {}): Required<ItemSelectorOptions> => {
|
|
4
|
-
|
|
5
|
-
const familyTitle = 'familyTitle' in options ? options.familyTitle! : 'short'
|
|
6
|
-
const showFamilyByline = 'showFamilyByline' in options ? options.showFamilyByline! : false
|
|
7
|
-
|
|
8
|
-
const showFamilyInOption = 'showFamilyInOption' in options ? options.showFamilyInOption! : false
|
|
9
|
-
const showByline = 'showByline' in options ? options.showByline! : true
|
|
10
|
-
|
|
11
|
-
const showPrice = 'showPrice' in options ? options.showPrice! : true
|
|
12
|
-
const showQuantity = 'showQuantity' in options ? options.showQuantity! : false
|
|
13
|
-
|
|
14
|
-
const buttonType = 'buttonType' in options ? options.buttonType! : 'text'
|
|
15
|
-
const horizButtons = 'horizButtons' in options ? options.horizButtons! : false
|
|
16
|
-
const showSlider = 'showSlider' in options ? options.showSlider! : true
|
|
17
|
-
|
|
18
|
-
const showButtonIfOnlyOne = 'showButtonIfOnlyOne' in options ? options.showButtonIfOnlyOne! : true
|
|
19
|
-
|
|
20
|
-
const sort = 'sort' in options ? options.sort! : 'none'
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
showFamilyInOption,
|
|
24
|
-
familyTitle,
|
|
25
|
-
showFamilyByline,
|
|
26
|
-
showByline,
|
|
27
|
-
showPrice,
|
|
28
|
-
showQuantity,
|
|
29
|
-
buttonType,
|
|
30
|
-
horizButtons,
|
|
31
|
-
showSlider,
|
|
32
|
-
showButtonIfOnlyOne,
|
|
33
|
-
sort,
|
|
34
|
-
}
|
|
35
|
-
}
|
package/util/line-item-ref.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { observable, action, computed, makeObservable } from 'mobx'
|
|
2
|
-
|
|
3
|
-
import type { LineItem, ObsLineItemRef } from '../types'
|
|
4
|
-
|
|
5
|
-
class LineItemRef implements ObsLineItemRef {
|
|
6
|
-
|
|
7
|
-
_item: LineItem | undefined = undefined
|
|
8
|
-
|
|
9
|
-
constructor() {
|
|
10
|
-
|
|
11
|
-
makeObservable(this, {
|
|
12
|
-
_item: observable,
|
|
13
|
-
item: computed,
|
|
14
|
-
set: action
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
get item(): LineItem | undefined { return this._item }
|
|
19
|
-
|
|
20
|
-
set = (v: LineItem | undefined): void => { this._item = v }
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default LineItemRef
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { MultiFamilySelectorOptions } from '../types'
|
|
2
|
-
|
|
3
|
-
export default (options: MultiFamilySelectorOptions | undefined = {}): Required<MultiFamilySelectorOptions> => {
|
|
4
|
-
|
|
5
|
-
const showParentTitle = 'showParentTitle' in options ? options.showParentTitle! : true
|
|
6
|
-
const showItemSwatches = 'showItemSwatches' in options ? options.showItemSwatches! : true
|
|
7
|
-
|
|
8
|
-
const parentByline = 'parentByline' in options ? options.parentByline! : 'none'
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
showParentTitle,
|
|
12
|
-
showItemSwatches,
|
|
13
|
-
parentByline,
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {makeObservable, observable, action} from 'mobx'
|
|
2
|
-
|
|
3
|
-
import type { StringMutator } from '../types'
|
|
4
|
-
|
|
5
|
-
class ObsStringMutator implements StringMutator {
|
|
6
|
-
|
|
7
|
-
_s: string | null
|
|
8
|
-
|
|
9
|
-
constructor(s: string) {
|
|
10
|
-
this._s = s
|
|
11
|
-
makeObservable(this, {
|
|
12
|
-
_s: observable,
|
|
13
|
-
set: action,
|
|
14
|
-
//get: computed .// no need
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
set(v: string | null): void { this._s = v }
|
|
19
|
-
get(): string | null { return this._s }
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export default ObsStringMutator
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { AnimationDef, ImageDef, MediaStackDef, VideoDef } from '@hanzo/ui/types'
|
|
2
|
-
|
|
3
|
-
interface FamilyMediaData {
|
|
4
|
-
img?: Record<string, ImageDef>
|
|
5
|
-
video?: Record<string, VideoDef>
|
|
6
|
-
anim?: Record<string, AnimationDef>
|
|
7
|
-
optionImg?: Record<string, ImageDef>
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
class ProductMediaAccessor {
|
|
11
|
-
|
|
12
|
-
_data: FamilyMediaData
|
|
13
|
-
|
|
14
|
-
constructor(data: FamilyMediaData) {
|
|
15
|
-
this._data = data
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
img = (key: string): ImageDef | undefined => (
|
|
19
|
-
(this._data.img) ? this._data.img[key] : undefined
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
spreadableImg = (key: string): { img?: ImageDef } => (
|
|
23
|
-
(this._data.img) ? {img: this._data.img[key]} : {}
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
video = (key: string): VideoDef | undefined => (
|
|
27
|
-
(this._data.video) ? this._data.video[key] : undefined
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
spreadableVideo = (key: string): { video?: VideoDef } => (
|
|
31
|
-
(this._data.video) ? {video: this._data.video[key]} : {}
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
anim = (key: string): AnimationDef | undefined => (
|
|
35
|
-
(this._data.anim) ? this._data.anim[key] : undefined
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
spreadableAnim = (key: string): { animation?: AnimationDef } => (
|
|
39
|
-
(this._data.anim) ? {animation: this._data.anim[key]} : {}
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
mediaStack = (key: string): MediaStackDef => ({
|
|
43
|
-
...this.spreadableImg(key),
|
|
44
|
-
...this.spreadableVideo(key),
|
|
45
|
-
...this.spreadableAnim(key)
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
optionImg = (key: string): ImageDef | undefined => (
|
|
50
|
-
(this._data.optionImg) ? this._data.optionImg[key] : undefined
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
spreadableOptionImg = (key: string): { optionImg?: ImageDef } => {
|
|
54
|
-
return (this._data.optionImg) ? { optionImg: this._data.optionImg[key]} : {}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export default ProductMediaAccessor
|
package/util/promo-codes.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type { Promo } from '../types'
|
|
2
|
-
|
|
3
|
-
const referallCodeDiscountedSkus = [
|
|
4
|
-
'LXM-CR-B-ABT', 'LXM-CR-B-GM', 'LXM-CR-F-CC', 'LXM-CR-F-IC', 'LXM-CR-E-24G', 'LXM-CR-E-SS', 'LXM-CR-S-RT', // credit cards
|
|
5
|
-
'LXM-VL-GN', 'LXM-VL-VL', 'LXM-VL-MI', 'LXM-VL-NA', // validators
|
|
6
|
-
'LXM-PS-PS', // pass
|
|
7
|
-
'LXM-AG-B-1_OZ', // silver
|
|
8
|
-
]
|
|
9
|
-
|
|
10
|
-
const PROMO_CODES: Promo[] = [
|
|
11
|
-
{
|
|
12
|
-
type: 'percent',
|
|
13
|
-
code: 'ANGEL',
|
|
14
|
-
value: 22
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
type: 'percent',
|
|
18
|
-
code: 'NASSER',
|
|
19
|
-
value: 11.11
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
type: 'percent',
|
|
23
|
-
code: 'ROSEY',
|
|
24
|
-
value: 20
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
type: 'percent',
|
|
28
|
-
code: 'IYKYK',
|
|
29
|
-
value: 11.1
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
type: 'percent',
|
|
33
|
-
code: 'GENESIS',
|
|
34
|
-
value: 99,
|
|
35
|
-
skus: ['LXM-PS-PS']
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
type: 'percent',
|
|
39
|
-
code: 'ANTJE',
|
|
40
|
-
value: 33.3,
|
|
41
|
-
skus: referallCodeDiscountedSkus
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
type: 'percent',
|
|
45
|
-
code: 'ASHLEY',
|
|
46
|
-
value: 33.3,
|
|
47
|
-
skus: referallCodeDiscountedSkus
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
type: 'percent',
|
|
51
|
-
code: 'CALE',
|
|
52
|
-
value: 33.3,
|
|
53
|
-
skus: referallCodeDiscountedSkus
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
type: 'percent',
|
|
57
|
-
code: 'DARA',
|
|
58
|
-
value: 33.3,
|
|
59
|
-
skus: referallCodeDiscountedSkus
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
type: 'percent',
|
|
63
|
-
code: 'KENJI',
|
|
64
|
-
value: 33.3,
|
|
65
|
-
skus: referallCodeDiscountedSkus
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
type: 'percent',
|
|
69
|
-
code: 'MAJOR',
|
|
70
|
-
value: 33.3,
|
|
71
|
-
skus: referallCodeDiscountedSkus
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
type: 'percent',
|
|
75
|
-
code: 'CYRUS',
|
|
76
|
-
value: 33.3,
|
|
77
|
-
skus: referallCodeDiscountedSkus
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
type: 'percent',
|
|
81
|
-
code: 'STOBIE',
|
|
82
|
-
value: 33.3,
|
|
83
|
-
skus: referallCodeDiscountedSkus
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
type: 'percent',
|
|
87
|
-
code: 'SKYLER',
|
|
88
|
-
value: 33.3,
|
|
89
|
-
skus: referallCodeDiscountedSkus
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
type: 'percent',
|
|
93
|
-
code: 'ZEEKAY',
|
|
94
|
-
value: 33.3,
|
|
95
|
-
skus: referallCodeDiscountedSkus
|
|
96
|
-
}
|
|
97
|
-
]
|
|
98
|
-
|
|
99
|
-
// TODO: implement a real API call
|
|
100
|
-
const getPromoFromApi = async (code: string) => {
|
|
101
|
-
return PROMO_CODES.find(promo => promo.code === code)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export {
|
|
105
|
-
getPromoFromApi as default
|
|
106
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { SelectionUISpecifier } from '../types'
|
|
2
|
-
import sep from '../service/sep'
|
|
3
|
-
|
|
4
|
-
const DEFAULT = {
|
|
5
|
-
multiFamily: {
|
|
6
|
-
type: 'all-variants-carousel'
|
|
7
|
-
},
|
|
8
|
-
singleFamily: { type: 'carousel' }
|
|
9
|
-
} satisfies SelectionUISpecifier
|
|
10
|
-
|
|
11
|
-
const map = new Map<string, SelectionUISpecifier>()
|
|
12
|
-
|
|
13
|
-
// key: first two tokens of path
|
|
14
|
-
export const initSelectionUI = (v: Record<string, SelectionUISpecifier>) => {
|
|
15
|
-
|
|
16
|
-
// Might have multiple calls client and server side
|
|
17
|
-
if (map.size > 0) {
|
|
18
|
-
map.clear()
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
for (let [key, value] of Object.entries(v)) {
|
|
22
|
-
map.set(key, value)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const getSelectionUISpecifier = (skuPath: string): SelectionUISpecifier => {
|
|
27
|
-
const key = skuPath.split(sep.tok).slice(0, 2).join(sep.tok)
|
|
28
|
-
const result = map.get(key)
|
|
29
|
-
return result ?? DEFAULT
|
|
30
|
-
}
|
package/util/square-payment.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// Payment processing - requires API endpoint
|
|
2
|
-
// For static builds, this will call an external payment API
|
|
3
|
-
|
|
4
|
-
// https://developer.squareup.com/blog/online-payments-with-square-and-react/
|
|
5
|
-
declare global {
|
|
6
|
-
interface BigInt {
|
|
7
|
-
toJSON(): string;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
BigInt.prototype.toJSON = function() { return this.toString(); }
|
|
12
|
-
|
|
13
|
-
const processPayment = async (sourceId: string, amount: number, verificationToken: string) => {
|
|
14
|
-
// For static builds, payments should be processed via an API endpoint
|
|
15
|
-
// Check if we're in a browser environment
|
|
16
|
-
if (typeof window !== 'undefined') {
|
|
17
|
-
// Client-side: call the payment API
|
|
18
|
-
try {
|
|
19
|
-
const response = await fetch('/api/payment', {
|
|
20
|
-
method: 'POST',
|
|
21
|
-
headers: {
|
|
22
|
-
'Content-Type': 'application/json',
|
|
23
|
-
},
|
|
24
|
-
body: JSON.stringify({
|
|
25
|
-
sourceId,
|
|
26
|
-
amount,
|
|
27
|
-
verificationToken
|
|
28
|
-
})
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
if (!response.ok) {
|
|
32
|
-
console.error('Payment API error:', response.statusText)
|
|
33
|
-
return null
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return await response.json()
|
|
37
|
-
} catch (error) {
|
|
38
|
-
console.error('Error processing payment:', error)
|
|
39
|
-
return null
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Server-side (for SSR builds only, not static export)
|
|
44
|
-
console.warn('Server-side payment processing not available in static export')
|
|
45
|
-
return null
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export {
|
|
49
|
-
processPayment as default
|
|
50
|
-
}
|