fontdue-js 2.11.0 → 2.12.1

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/CHANGELOG.md CHANGED
@@ -1,17 +1,31 @@
1
+ ## 2.12.0
2
+
3
+ - Adds "share cart" feature
4
+
5
+ ## 2.11.1
6
+
7
+ - Fixed type tester autofit with features enabled
8
+ - Added missing descriptions to order variables
9
+
10
+ ## 2.11.0
11
+
12
+ - Added support for order variables, and Stripe Tax via embedded checkout
13
+ - Redesigned checkout flow to be more unified with the cart
14
+
1
15
  ## 2.10.1
2
16
 
3
17
  - Fixed issue with combining characters causing React hydration errors
4
18
 
5
19
  ## 2.10.0
6
20
 
7
- - Fix an issue displaying JPY prices
8
- - Improve support for Arabic-only fonts
21
+ - Fixed an issue displaying JPY prices
22
+ - Improved support for Arabic-only fonts
9
23
  - Fixed an issue displaying "combining" type characters in Safari in CharacterViewer
10
24
  - Improved performance issue loading TypeTesters
11
25
 
12
26
  ## 2.9.0
13
27
 
14
- - Updates CharacterViewer component, preparing for customizing groupings
28
+ - Updated CharacterViewer component, preparing for customizing groupings
15
29
 
16
30
  ## 2.8.3
17
31
 
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @generated SignedSource<<a4b4b22cee06bf7a0b71e5b62dbc94d0>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+ import { ConcreteRequest } from 'relay-runtime';
7
+ export type CartTotalsCreateSnapshotMutation$variables = Record<PropertyKey, never>;
8
+ export type CartTotalsCreateSnapshotMutation$data = {
9
+ readonly createOrderSnapshot: {
10
+ readonly orderSnapshot: {
11
+ readonly id: string | null;
12
+ readonly quotePdfUrl: string | null;
13
+ readonly shareUrl: string | null;
14
+ } | null;
15
+ } | null;
16
+ };
17
+ export type CartTotalsCreateSnapshotMutation = {
18
+ response: CartTotalsCreateSnapshotMutation$data;
19
+ variables: CartTotalsCreateSnapshotMutation$variables;
20
+ };
21
+ declare const node: ConcreteRequest;
22
+ export default node;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /**
8
+ * @generated SignedSource<<a4b4b22cee06bf7a0b71e5b62dbc94d0>>
9
+ * @lightSyntaxTransform
10
+ * @nogrep
11
+ */
12
+
13
+ /* tslint:disable */
14
+ /* eslint-disable */
15
+ // @ts-nocheck
16
+
17
+ const node = function () {
18
+ var v0 = [{
19
+ "alias": null,
20
+ "args": null,
21
+ "concreteType": "CreateOrderSnapshotPayload",
22
+ "kind": "LinkedField",
23
+ "name": "createOrderSnapshot",
24
+ "plural": false,
25
+ "selections": [{
26
+ "alias": null,
27
+ "args": null,
28
+ "concreteType": "OrderSnapshot",
29
+ "kind": "LinkedField",
30
+ "name": "orderSnapshot",
31
+ "plural": false,
32
+ "selections": [{
33
+ "alias": null,
34
+ "args": null,
35
+ "kind": "ScalarField",
36
+ "name": "id",
37
+ "storageKey": null
38
+ }, {
39
+ "alias": null,
40
+ "args": null,
41
+ "kind": "ScalarField",
42
+ "name": "quotePdfUrl",
43
+ "storageKey": null
44
+ }, {
45
+ "alias": null,
46
+ "args": null,
47
+ "kind": "ScalarField",
48
+ "name": "shareUrl",
49
+ "storageKey": null
50
+ }],
51
+ "storageKey": null
52
+ }],
53
+ "storageKey": null
54
+ }];
55
+ return {
56
+ "fragment": {
57
+ "argumentDefinitions": [],
58
+ "kind": "Fragment",
59
+ "metadata": null,
60
+ "name": "CartTotalsCreateSnapshotMutation",
61
+ "selections": v0 /*: any*/,
62
+ "type": "RootMutationType",
63
+ "abstractKey": null
64
+ },
65
+ "kind": "Request",
66
+ "operation": {
67
+ "argumentDefinitions": [],
68
+ "kind": "Operation",
69
+ "name": "CartTotalsCreateSnapshotMutation",
70
+ "selections": v0 /*: any*/
71
+ },
72
+ "params": {
73
+ "cacheID": "68ef1e5c60fc0176904bdfe545718bd9",
74
+ "id": null,
75
+ "metadata": {},
76
+ "name": "CartTotalsCreateSnapshotMutation",
77
+ "operationKind": "mutation",
78
+ "text": "mutation CartTotalsCreateSnapshotMutation {\n createOrderSnapshot {\n orderSnapshot {\n id\n quotePdfUrl\n shareUrl\n }\n }\n}\n"
79
+ }
80
+ };
81
+ }();
82
+ node.hash = "97e00cf77f0cc65bb808123fe5944c02";
83
+ var _default = node;
84
+ exports.default = _default;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<f15aa40c78fa3495090d995a230b1fc4>>
2
+ * @generated SignedSource<<de8bb4c3b19d357c74d2ae364c8acf3a>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  /**
8
- * @generated SignedSource<<f15aa40c78fa3495090d995a230b1fc4>>
8
+ * @generated SignedSource<<de8bb4c3b19d357c74d2ae364c8acf3a>>
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
11
11
  */
@@ -48,10 +48,14 @@ const node = function () {
48
48
  "storageKey": null
49
49
  }, {
50
50
  "alias": null,
51
- "args": null,
51
+ "args": [{
52
+ "kind": "Literal",
53
+ "name": "format",
54
+ "value": "HTML"
55
+ }],
52
56
  "kind": "ScalarField",
53
57
  "name": "description",
54
- "storageKey": null
58
+ "storageKey": "description(format:\"HTML\")"
55
59
  }, {
56
60
  "alias": null,
57
61
  "args": null,
@@ -74,6 +78,6 @@ const node = function () {
74
78
  "abstractKey": null
75
79
  };
76
80
  }();
77
- node.hash = "cce511c94f6bca99792a0407a8d0d6a3";
81
+ node.hash = "791f9f19a96e680b9fa2b1ad81e8aa2f";
78
82
  var _default = node;
79
83
  exports.default = _default;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<870223466fc5b3df6420356e151dff54>>
2
+ * @generated SignedSource<<46260b9d37ad93e8d30a26e3d36b4367>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  /**
8
- * @generated SignedSource<<870223466fc5b3df6420356e151dff54>>
8
+ * @generated SignedSource<<46260b9d37ad93e8d30a26e3d36b4367>>
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
11
11
  */
@@ -62,10 +62,10 @@ const node = function () {
62
62
  }],
63
63
  v8 = {
64
64
  "alias": null,
65
- "args": null,
65
+ "args": v7 /*: any*/,
66
66
  "kind": "ScalarField",
67
67
  "name": "description",
68
- "storageKey": null
68
+ "storageKey": "description(format:\"HTML\")"
69
69
  },
70
70
  v9 = {
71
71
  "alias": null,
@@ -843,12 +843,12 @@ const node = function () {
843
843
  }]
844
844
  },
845
845
  "params": {
846
- "cacheID": "5c5e17793f013c188d307c83f9898fc4",
846
+ "cacheID": "278792fe92897cc87a5ce92baae4d69e",
847
847
  "id": null,
848
848
  "metadata": {},
849
849
  "name": "StoreModalCartQuery",
850
850
  "operationKind": "query",
851
- "text": "query StoreModalCartQuery {\n viewer {\n ...StripeProvider_viewer\n ...OrderVariableSelection_variables\n ...StoreModalOrderVariableSelection_viewer\n ...StoreModalUnifiedCheckout_viewer\n currentOrder {\n ...CartState_order\n ...CartTotals_order\n ...StoreModalUnifiedCheckout_order\n id\n orderItems {\n id\n ...CartItem_node\n licenseSelections {\n licenseVariable {\n variableType\n id\n }\n variableText\n id\n }\n }\n discount {\n id\n }\n stripePaymentMethod {\n id\n }\n billingIdentity {\n name\n }\n }\n id\n }\n}\n\nfragment AddressFields_viewer on Viewer {\n countries {\n code\n name\n }\n}\n\nfragment CartItemAdditionalLicenses_licenses on License {\n id\n name\n}\n\nfragment CartItemAdditionalLicenses_orderItem on OrderItem {\n licenseSelections {\n license {\n id\n }\n id\n }\n}\n\nfragment CartItemLicense_selection on LicenseSelection {\n id\n license {\n id\n name\n licenseVariables {\n id\n ...CartItemVariable_variable\n }\n }\n licenseVariable {\n id\n }\n ...CartItemVariable_selection\n}\n\nfragment CartItemProduct_product on SkuProduct {\n __isSkuProduct: __typename\n __typename\n ...CollectionAa_product\n ...FontStyle_fontStyle\n ... on FontStyle {\n family {\n name\n cssUrl\n id\n }\n name\n variableInstances {\n name\n }\n }\n ... on Bundle {\n name\n }\n ... on FontCollection {\n name\n isVariableFont\n totalStyles\n featureStyle {\n family {\n cssUrl\n id\n }\n id\n }\n }\n}\n\nfragment CartItemVariable_selection on LicenseSelection {\n id\n variableText\n license {\n id\n }\n licenseVariable {\n ...VariableTableAmounts_variable\n id\n name\n variableType\n licenseOptions {\n id\n }\n }\n licenseOption {\n ...VariableTableAmounts_option\n id\n name\n amount\n }\n}\n\nfragment CartItemVariable_variable on LicenseVariable {\n id\n licenseOptions {\n id\n name\n amount\n }\n}\n\nfragment CartItem_node on OrderItem {\n ...CartItemAdditionalLicenses_orderItem\n id\n price {\n ...Price_price\n }\n sku {\n price {\n ...Price_price\n }\n product {\n ...CartItemProduct_product\n __typename\n ... on Licenseable {\n __isLicenseable: __typename\n licenses {\n ...CartItemAdditionalLicenses_licenses\n id\n licenseVariables {\n id\n licenseOptions {\n id\n }\n }\n }\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n id\n }\n licenseSelections {\n ...CartItemLicense_selection\n id\n license {\n id\n }\n licenseVariable {\n id\n }\n licenseOption {\n id\n }\n variableText\n }\n}\n\nfragment CartState_order on Order {\n id\n orderItems {\n id\n licenseSelections {\n license {\n id\n }\n licenseVariable {\n id\n }\n licenseOption {\n id\n }\n variableText\n id\n }\n }\n orderVariableSelections {\n orderVariable {\n id\n }\n orderVariableOption {\n id\n }\n id\n }\n}\n\nfragment CartTotals_order on Order {\n subtotal {\n ...Price_price\n }\n discount {\n amount {\n amount\n ...Price_price\n }\n coupon {\n ...CouponText_coupon\n id\n }\n id\n }\n discountedSubtotal {\n ...Price_price\n }\n total {\n amount\n ...Price_price\n }\n taxRate\n taxes {\n ...Price_price\n }\n taxName\n gstIncluded\n}\n\nfragment CollectionAa_product on SkuProduct {\n __isSkuProduct: __typename\n __typename\n ... on FontCollection {\n featureStyle {\n ...FontStyle_fontStyle\n id\n }\n }\n ... on Bundle {\n fontStyles {\n ...FontStyle_fontStyle\n id\n }\n }\n}\n\nfragment CouponText_coupon on Coupon {\n type\n percentAmount\n creditAmount {\n amount\n currency\n }\n creditAmountRemaining {\n amount\n currency\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n cssFamily\n name\n}\n\nfragment OrderVariableSelection_variables on Viewer {\n orderVariables {\n id\n name\n variableType\n description\n orderVariableOptions {\n id\n amount\n }\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment StoreModalOrderVariableSelection_viewer on Viewer {\n ...OrderVariableSelection_variables\n orderVariables {\n id\n }\n currentOrder {\n id\n orderVariableSelections {\n orderVariable {\n id\n name\n variableType\n description\n }\n orderVariableOption {\n id\n amount\n }\n id\n }\n }\n settings {\n storeModalSelectOrderVariablesLabel(format: HTML)\n }\n}\n\nfragment StoreModalReviewIdentity_identity on Identity {\n email\n phoneFormatted\n addressFormatted\n vatNumber\n}\n\nfragment StoreModalUnifiedCheckout_order on Order {\n completeUrl\n canCompleteWithCoupon\n total {\n amount\n }\n customer {\n name\n email\n newsletterOptIn\n id\n }\n licenseeIsBillingIdentity\n licenseeIdentity {\n ...StoreModalReviewIdentity_identity\n name\n organization\n email\n phone\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n billingIdentity {\n ...StoreModalReviewIdentity_identity\n name\n organization\n email\n phone\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n}\n\nfragment StoreModalUnifiedCheckout_viewer on Viewer {\n ...AddressFields_viewer\n country\n settings {\n uiFontName\n eulaAgreementLabel(format: HTML)\n storeModalSelectLicenseeLabel(format: HTML)\n newsletterOptInLabel\n taxSystem\n }\n themeConfig {\n customProperties\n }\n}\n\nfragment StripeProvider_viewer on Viewer {\n settings {\n uiFontUrl\n uiFontName\n taxSystem\n }\n themeConfig {\n customProperties\n }\n stripeAccountId\n stripePublishableKey\n currentOrder {\n stripePaymentIntent {\n clientSecret\n }\n id\n }\n}\n\nfragment VariableTableAmounts_option on LicenseOption {\n amounts\n}\n\nfragment VariableTableAmounts_variable on LicenseVariable {\n units\n}\n"
851
+ "text": "query StoreModalCartQuery {\n viewer {\n ...StripeProvider_viewer\n ...OrderVariableSelection_variables\n ...StoreModalOrderVariableSelection_viewer\n ...StoreModalUnifiedCheckout_viewer\n currentOrder {\n ...CartState_order\n ...CartTotals_order\n ...StoreModalUnifiedCheckout_order\n id\n orderItems {\n id\n ...CartItem_node\n licenseSelections {\n licenseVariable {\n variableType\n id\n }\n variableText\n id\n }\n }\n discount {\n id\n }\n stripePaymentMethod {\n id\n }\n billingIdentity {\n name\n }\n }\n id\n }\n}\n\nfragment AddressFields_viewer on Viewer {\n countries {\n code\n name\n }\n}\n\nfragment CartItemAdditionalLicenses_licenses on License {\n id\n name\n}\n\nfragment CartItemAdditionalLicenses_orderItem on OrderItem {\n licenseSelections {\n license {\n id\n }\n id\n }\n}\n\nfragment CartItemLicense_selection on LicenseSelection {\n id\n license {\n id\n name\n licenseVariables {\n id\n ...CartItemVariable_variable\n }\n }\n licenseVariable {\n id\n }\n ...CartItemVariable_selection\n}\n\nfragment CartItemProduct_product on SkuProduct {\n __isSkuProduct: __typename\n __typename\n ...CollectionAa_product\n ...FontStyle_fontStyle\n ... on FontStyle {\n family {\n name\n cssUrl\n id\n }\n name\n variableInstances {\n name\n }\n }\n ... on Bundle {\n name\n }\n ... on FontCollection {\n name\n isVariableFont\n totalStyles\n featureStyle {\n family {\n cssUrl\n id\n }\n id\n }\n }\n}\n\nfragment CartItemVariable_selection on LicenseSelection {\n id\n variableText\n license {\n id\n }\n licenseVariable {\n ...VariableTableAmounts_variable\n id\n name\n variableType\n licenseOptions {\n id\n }\n }\n licenseOption {\n ...VariableTableAmounts_option\n id\n name\n amount\n }\n}\n\nfragment CartItemVariable_variable on LicenseVariable {\n id\n licenseOptions {\n id\n name\n amount\n }\n}\n\nfragment CartItem_node on OrderItem {\n ...CartItemAdditionalLicenses_orderItem\n id\n price {\n ...Price_price\n }\n sku {\n price {\n ...Price_price\n }\n product {\n ...CartItemProduct_product\n __typename\n ... on Licenseable {\n __isLicenseable: __typename\n licenses {\n ...CartItemAdditionalLicenses_licenses\n id\n licenseVariables {\n id\n licenseOptions {\n id\n }\n }\n }\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n id\n }\n licenseSelections {\n ...CartItemLicense_selection\n id\n license {\n id\n }\n licenseVariable {\n id\n }\n licenseOption {\n id\n }\n variableText\n }\n}\n\nfragment CartState_order on Order {\n id\n orderItems {\n id\n licenseSelections {\n license {\n id\n }\n licenseVariable {\n id\n }\n licenseOption {\n id\n }\n variableText\n id\n }\n }\n orderVariableSelections {\n orderVariable {\n id\n }\n orderVariableOption {\n id\n }\n id\n }\n}\n\nfragment CartTotals_order on Order {\n subtotal {\n ...Price_price\n }\n discount {\n amount {\n amount\n ...Price_price\n }\n coupon {\n ...CouponText_coupon\n id\n }\n id\n }\n discountedSubtotal {\n ...Price_price\n }\n total {\n amount\n ...Price_price\n }\n taxRate\n taxes {\n ...Price_price\n }\n taxName\n gstIncluded\n}\n\nfragment CollectionAa_product on SkuProduct {\n __isSkuProduct: __typename\n __typename\n ... on FontCollection {\n featureStyle {\n ...FontStyle_fontStyle\n id\n }\n }\n ... on Bundle {\n fontStyles {\n ...FontStyle_fontStyle\n id\n }\n }\n}\n\nfragment CouponText_coupon on Coupon {\n type\n percentAmount\n creditAmount {\n amount\n currency\n }\n creditAmountRemaining {\n amount\n currency\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n cssFamily\n name\n}\n\nfragment OrderVariableSelection_variables on Viewer {\n orderVariables {\n id\n name\n variableType\n description(format: HTML)\n orderVariableOptions {\n id\n amount\n }\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment StoreModalOrderVariableSelection_viewer on Viewer {\n ...OrderVariableSelection_variables\n orderVariables {\n id\n }\n currentOrder {\n id\n orderVariableSelections {\n orderVariable {\n id\n name\n variableType\n description(format: HTML)\n }\n orderVariableOption {\n id\n amount\n }\n id\n }\n }\n settings {\n storeModalSelectOrderVariablesLabel(format: HTML)\n }\n}\n\nfragment StoreModalReviewIdentity_identity on Identity {\n email\n phoneFormatted\n addressFormatted\n vatNumber\n}\n\nfragment StoreModalUnifiedCheckout_order on Order {\n completeUrl\n canCompleteWithCoupon\n total {\n amount\n }\n customer {\n name\n email\n newsletterOptIn\n id\n }\n licenseeIsBillingIdentity\n licenseeIdentity {\n ...StoreModalReviewIdentity_identity\n name\n organization\n email\n phone\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n billingIdentity {\n ...StoreModalReviewIdentity_identity\n name\n organization\n email\n phone\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n}\n\nfragment StoreModalUnifiedCheckout_viewer on Viewer {\n ...AddressFields_viewer\n country\n settings {\n uiFontName\n eulaAgreementLabel(format: HTML)\n storeModalSelectLicenseeLabel(format: HTML)\n newsletterOptInLabel\n taxSystem\n }\n themeConfig {\n customProperties\n }\n}\n\nfragment StripeProvider_viewer on Viewer {\n settings {\n uiFontUrl\n uiFontName\n taxSystem\n }\n themeConfig {\n customProperties\n }\n stripeAccountId\n stripePublishableKey\n currentOrder {\n stripePaymentIntent {\n clientSecret\n }\n id\n }\n}\n\nfragment VariableTableAmounts_option on LicenseOption {\n amounts\n}\n\nfragment VariableTableAmounts_variable on LicenseVariable {\n units\n}\n"
852
852
  }
853
853
  };
854
854
  }();
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<c36e7037fc2da9ce00e6a2992de27344>>
2
+ * @generated SignedSource<<4d008354a0e2564d192e0426c6f620ff>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  /**
8
- * @generated SignedSource<<c36e7037fc2da9ce00e6a2992de27344>>
8
+ * @generated SignedSource<<4d008354a0e2564d192e0426c6f620ff>>
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
11
11
  */
@@ -16,12 +16,17 @@ exports.default = void 0;
16
16
 
17
17
  const node = function () {
18
18
  var v0 = {
19
- "alias": null,
20
- "args": null,
21
- "kind": "ScalarField",
22
- "name": "id",
23
- "storageKey": null
24
- };
19
+ "alias": null,
20
+ "args": null,
21
+ "kind": "ScalarField",
22
+ "name": "id",
23
+ "storageKey": null
24
+ },
25
+ v1 = [{
26
+ "kind": "Literal",
27
+ "name": "format",
28
+ "value": "HTML"
29
+ }];
25
30
  return {
26
31
  "argumentDefinitions": [],
27
32
  "kind": "Fragment",
@@ -75,10 +80,10 @@ const node = function () {
75
80
  "storageKey": null
76
81
  }, {
77
82
  "alias": null,
78
- "args": null,
83
+ "args": v1 /*: any*/,
79
84
  "kind": "ScalarField",
80
85
  "name": "description",
81
- "storageKey": null
86
+ "storageKey": "description(format:\"HTML\")"
82
87
  }],
83
88
  "storageKey": null
84
89
  }, {
@@ -109,11 +114,7 @@ const node = function () {
109
114
  "plural": false,
110
115
  "selections": [{
111
116
  "alias": null,
112
- "args": [{
113
- "kind": "Literal",
114
- "name": "format",
115
- "value": "HTML"
116
- }],
117
+ "args": v1 /*: any*/,
117
118
  "kind": "ScalarField",
118
119
  "name": "storeModalSelectOrderVariablesLabel",
119
120
  "storageKey": "storeModalSelectOrderVariablesLabel(format:\"HTML\")"
@@ -124,6 +125,6 @@ const node = function () {
124
125
  "abstractKey": null
125
126
  };
126
127
  }();
127
- node.hash = "6c2f30b0ff62d54822aad2c955b0a579";
128
+ node.hash = "bdc0a78f68144b3270e1b8bf38f5d13f";
128
129
  var _default = node;
129
130
  exports.default = _default;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<4ec4bb086ba178c3186f38f5570a2454>>
2
+ * @generated SignedSource<<805daec4cc949f1911ae9ef13e86f405>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  /**
8
- * @generated SignedSource<<4ec4bb086ba178c3186f38f5570a2454>>
8
+ * @generated SignedSource<<805daec4cc949f1911ae9ef13e86f405>>
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
11
11
  */
@@ -300,15 +300,22 @@ const node = function () {
300
300
  "selections": [v4 /*: any*/, v29 /*: any*/, v11 /*: any*/, v19 /*: any*/],
301
301
  "storageKey": null
302
302
  },
303
- v31 = [v17 /*: any*/],
304
- v32 = [v25 /*: any*/, {
303
+ v31 = {
304
+ "alias": null,
305
+ "args": v12 /*: any*/,
306
+ "kind": "ScalarField",
307
+ "name": "description",
308
+ "storageKey": "description(format:\"HTML\")"
309
+ },
310
+ v32 = [v17 /*: any*/],
311
+ v33 = [v25 /*: any*/, {
305
312
  "alias": null,
306
313
  "args": v7 /*: any*/,
307
314
  "concreteType": "Money",
308
315
  "kind": "LinkedField",
309
316
  "name": "totalStylesPrice",
310
317
  "plural": false,
311
- "selections": v31 /*: any*/,
318
+ "selections": v32 /*: any*/,
312
319
  "storageKey": null
313
320
  }];
314
321
  return {
@@ -408,13 +415,7 @@ const node = function () {
408
415
  "kind": "ScalarField",
409
416
  "name": "url",
410
417
  "storageKey": null
411
- }, v11 /*: any*/, {
412
- "alias": null,
413
- "args": v12 /*: any*/,
414
- "kind": "ScalarField",
415
- "name": "description",
416
- "storageKey": "description(format:\"HTML\")"
417
- }, {
418
+ }, v11 /*: any*/, v31 /*: any*/, {
418
419
  "alias": null,
419
420
  "args": null,
420
421
  "kind": "ScalarField",
@@ -471,13 +472,7 @@ const node = function () {
471
472
  "kind": "LinkedField",
472
473
  "name": "orderVariables",
473
474
  "plural": true,
474
- "selections": [v4 /*: any*/, v11 /*: any*/, v10 /*: any*/, {
475
- "alias": null,
476
- "args": null,
477
- "kind": "ScalarField",
478
- "name": "description",
479
- "storageKey": null
480
- }, {
475
+ "selections": [v4 /*: any*/, v11 /*: any*/, v10 /*: any*/, v31 /*: any*/, {
481
476
  "alias": null,
482
477
  "args": null,
483
478
  "concreteType": "OrderVariableOption",
@@ -534,7 +529,7 @@ const node = function () {
534
529
  "kind": "LinkedField",
535
530
  "name": "price",
536
531
  "plural": false,
537
- "selections": v31 /*: any*/,
532
+ "selections": v32 /*: any*/,
538
533
  "storageKey": null
539
534
  }, {
540
535
  "alias": null,
@@ -545,12 +540,12 @@ const node = function () {
545
540
  "plural": false,
546
541
  "selections": [v14 /*: any*/, {
547
542
  "kind": "InlineFragment",
548
- "selections": v32 /*: any*/,
543
+ "selections": v33 /*: any*/,
549
544
  "type": "FontCollection",
550
545
  "abstractKey": null
551
546
  }, {
552
547
  "kind": "InlineFragment",
553
- "selections": v32 /*: any*/,
548
+ "selections": v33 /*: any*/,
554
549
  "type": "Bundle",
555
550
  "abstractKey": null
556
551
  }, {
@@ -578,12 +573,12 @@ const node = function () {
578
573
  }]
579
574
  },
580
575
  "params": {
581
- "cacheID": "35cd734204bde322616fb0cd81377a12",
576
+ "cacheID": "0000e5627cdb76f523917c405654fd98",
582
577
  "id": null,
583
578
  "metadata": {},
584
579
  "name": "StoreModalProductQuery",
585
580
  "operationKind": "query",
586
- "text": "query StoreModalProductQuery(\n $productId: ID!\n $licenseOptions: [LicenseOptionsSpec]!\n $orderVariables: [OrderVariableSelectionInput!]\n) {\n collection: node(id: $productId) {\n __typename\n id\n ...StoreModalProductContent_collection_4sncub\n }\n viewer {\n endpoint\n stripeAccountId\n ...OrderVariableSelectionRedux_viewer\n ...StoreModalProductSummary_viewer_4sncub\n orderVariables {\n id\n variableType\n name\n }\n settings {\n storeModalSelectLicenseeLabel(format: HTML)\n storeModalSelectOrderVariablesLabel(format: HTML)\n storeModalSelectLicensesLabel(format: HTML)\n storeModalSelectFontsLabel(format: HTML)\n }\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n cssFamily\n name\n}\n\nfragment OrderVariableSelectionRedux_viewer on Viewer {\n ...OrderVariableSelection_variables\n}\n\nfragment OrderVariableSelection_variables on Viewer {\n orderVariables {\n id\n name\n variableType\n description\n orderVariableOptions {\n id\n amount\n }\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_4sncub on Sku {\n id\n price(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n amount\n ...Price_price\n }\n}\n\nfragment StoreModalBundleButton_bundle_4sncub on Bundle {\n id\n name\n sku {\n ...SKUPrice_sku_4sncub\n id\n }\n fontStyles {\n id\n ...FontStyle_fontStyle\n }\n}\n\nfragment StoreModalFamilyButton_collection_4sncub on FontCollection {\n isVariableFont\n collectionType\n name\n sku {\n ...SKUPrice_sku_4sncub\n id\n }\n parent {\n id\n }\n featureStyle {\n ...FontStyle_fontStyle\n supportedLanguages\n id\n }\n totalStyles\n totalStylesPrice {\n ...Price_price\n }\n ...useTotalStyles_fontCollection\n}\n\nfragment StoreModalFamily_collection_4sncub on FontCollection {\n ...StoreModalFamilyButton_collection_4sncub\n cssUrl\n collectionType\n sku {\n id\n }\n isVariableFont\n bundles {\n id\n fontStyles {\n id\n cssFamily\n cssWeight\n cssStretch\n ...StoreModalStyleButton_fontStyle_4sncub\n }\n ...StoreModalBundleButton_bundle_4sncub\n }\n fontStyles {\n id\n cssFamily\n cssWeight\n cssStretch\n ...StoreModalStyleButton_fontStyle_4sncub\n }\n}\n\nfragment StoreModalProductContent_collection_4sncub on Node {\n __isNode: __typename\n ... on FontCollection {\n id\n ...StoreModalFamily_collection_4sncub\n ...StoreModalProductLicenseSelection_collection\n children(collectionTypes: [FAMILY]) {\n id\n ...StoreModalFamily_collection_4sncub\n }\n }\n id\n}\n\nfragment StoreModalProductLicenseSelection_collection on FontCollection {\n licenses {\n id\n ...StoreModalProductLicense_license\n }\n}\n\nfragment StoreModalProductLicense_license on License {\n id\n url\n name\n description(format: HTML)\n defaultSelected\n variables: licenseVariables {\n id\n name\n variableType\n ...VariableTableAmounts_variable\n options: licenseOptions {\n id\n name\n amount\n ...VariableTableAmounts_option\n }\n }\n}\n\nfragment StoreModalProductSummary_viewer_4sncub on Viewer {\n taxCollections {\n taxName\n inclusive\n }\n orderVariables {\n id\n variableType\n name\n }\n precart(skuIds: [], licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n skus {\n price(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n amount\n }\n product {\n __typename\n ... on FontCollection {\n totalStyles\n totalStylesPrice(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n amount\n }\n }\n ... on Bundle {\n totalStyles\n totalStylesPrice(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n amount\n }\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n id\n }\n subtotal {\n ...Price_price\n amount\n currency\n }\n }\n}\n\nfragment StoreModalStyleButton_fontStyle_4sncub on FontStyle {\n id\n name\n supportedLanguages\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n sku {\n ...SKUPrice_sku_4sncub\n id\n }\n ...FontStyle_fontStyle\n}\n\nfragment VariableTableAmounts_option on LicenseOption {\n amounts\n}\n\nfragment VariableTableAmounts_variable on LicenseVariable {\n units\n}\n\nfragment useTotalStyles_fontCollection on FontCollection {\n isVariableFont\n totalStyles\n children(collectionTypes: [FAMILY]) {\n isVariableFont\n totalStyles\n id\n }\n}\n"
581
+ "text": "query StoreModalProductQuery(\n $productId: ID!\n $licenseOptions: [LicenseOptionsSpec]!\n $orderVariables: [OrderVariableSelectionInput!]\n) {\n collection: node(id: $productId) {\n __typename\n id\n ...StoreModalProductContent_collection_4sncub\n }\n viewer {\n endpoint\n stripeAccountId\n ...OrderVariableSelectionRedux_viewer\n ...StoreModalProductSummary_viewer_4sncub\n orderVariables {\n id\n variableType\n name\n }\n settings {\n storeModalSelectLicenseeLabel(format: HTML)\n storeModalSelectOrderVariablesLabel(format: HTML)\n storeModalSelectLicensesLabel(format: HTML)\n storeModalSelectFontsLabel(format: HTML)\n }\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n cssFamily\n name\n}\n\nfragment OrderVariableSelectionRedux_viewer on Viewer {\n ...OrderVariableSelection_variables\n}\n\nfragment OrderVariableSelection_variables on Viewer {\n orderVariables {\n id\n name\n variableType\n description(format: HTML)\n orderVariableOptions {\n id\n amount\n }\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_4sncub on Sku {\n id\n price(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n amount\n ...Price_price\n }\n}\n\nfragment StoreModalBundleButton_bundle_4sncub on Bundle {\n id\n name\n sku {\n ...SKUPrice_sku_4sncub\n id\n }\n fontStyles {\n id\n ...FontStyle_fontStyle\n }\n}\n\nfragment StoreModalFamilyButton_collection_4sncub on FontCollection {\n isVariableFont\n collectionType\n name\n sku {\n ...SKUPrice_sku_4sncub\n id\n }\n parent {\n id\n }\n featureStyle {\n ...FontStyle_fontStyle\n supportedLanguages\n id\n }\n totalStyles\n totalStylesPrice {\n ...Price_price\n }\n ...useTotalStyles_fontCollection\n}\n\nfragment StoreModalFamily_collection_4sncub on FontCollection {\n ...StoreModalFamilyButton_collection_4sncub\n cssUrl\n collectionType\n sku {\n id\n }\n isVariableFont\n bundles {\n id\n fontStyles {\n id\n cssFamily\n cssWeight\n cssStretch\n ...StoreModalStyleButton_fontStyle_4sncub\n }\n ...StoreModalBundleButton_bundle_4sncub\n }\n fontStyles {\n id\n cssFamily\n cssWeight\n cssStretch\n ...StoreModalStyleButton_fontStyle_4sncub\n }\n}\n\nfragment StoreModalProductContent_collection_4sncub on Node {\n __isNode: __typename\n ... on FontCollection {\n id\n ...StoreModalFamily_collection_4sncub\n ...StoreModalProductLicenseSelection_collection\n children(collectionTypes: [FAMILY]) {\n id\n ...StoreModalFamily_collection_4sncub\n }\n }\n id\n}\n\nfragment StoreModalProductLicenseSelection_collection on FontCollection {\n licenses {\n id\n ...StoreModalProductLicense_license\n }\n}\n\nfragment StoreModalProductLicense_license on License {\n id\n url\n name\n description(format: HTML)\n defaultSelected\n variables: licenseVariables {\n id\n name\n variableType\n ...VariableTableAmounts_variable\n options: licenseOptions {\n id\n name\n amount\n ...VariableTableAmounts_option\n }\n }\n}\n\nfragment StoreModalProductSummary_viewer_4sncub on Viewer {\n taxCollections {\n taxName\n inclusive\n }\n orderVariables {\n id\n variableType\n name\n }\n precart(skuIds: [], licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n skus {\n price(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n amount\n }\n product {\n __typename\n ... on FontCollection {\n totalStyles\n totalStylesPrice(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n amount\n }\n }\n ... on Bundle {\n totalStyles\n totalStylesPrice(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n amount\n }\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n id\n }\n subtotal {\n ...Price_price\n amount\n currency\n }\n }\n}\n\nfragment StoreModalStyleButton_fontStyle_4sncub on FontStyle {\n id\n name\n supportedLanguages\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n sku {\n ...SKUPrice_sku_4sncub\n id\n }\n ...FontStyle_fontStyle\n}\n\nfragment VariableTableAmounts_option on LicenseOption {\n amounts\n}\n\nfragment VariableTableAmounts_variable on LicenseVariable {\n units\n}\n\nfragment useTotalStyles_fontCollection on FontCollection {\n isVariableFont\n totalStyles\n children(collectionTypes: [FAMILY]) {\n isVariableFont\n totalStyles\n id\n }\n}\n"
587
582
  }
588
583
  };
589
584
  }();
@@ -5,19 +5,98 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = CartTotals;
7
7
  var _CartTotals_order2 = _interopRequireDefault(require("../../__generated__/CartTotals_order.graphql"));
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _CartTotalsCreateSnapshotMutation2 = _interopRequireDefault(require("../../__generated__/CartTotalsCreateSnapshotMutation.graphql"));
9
+ var _react = _interopRequireWildcard(require("react"));
9
10
  var _reactRelay = require("react-relay");
10
11
  var _relayRuntime = require("relay-runtime");
11
12
  var _Price = _interopRequireDefault(require("../Price"));
12
13
  var _CouponText = _interopRequireDefault(require("../CouponText"));
13
14
  var _Icons = require("../Icons");
15
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
18
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
16
19
  function percentage(decimalValue) {
17
20
  if (!decimalValue) return null;
18
21
  return `${parseFloat(decimalValue) * 100}%`;
19
22
  }
20
- const PriceBlock = _ref => {
23
+ function ShareCart() {
24
+ const environment = (0, _reactRelay.useRelayEnvironment)();
25
+ const [isSharing, setIsSharing] = (0, _react.useState)(false);
26
+ const [snapshot, setSnapshot] = (0, _react.useState)(null);
27
+ const [shareError, setShareError] = (0, _react.useState)(null);
28
+ const [copied, setCopied] = (0, _react.useState)(false);
29
+ const inputRef = (0, _react.useRef)(null);
30
+ const handleShareCart = () => {
31
+ setIsSharing(true);
32
+ setShareError(null);
33
+ (0, _reactRelay.commitMutation)(environment, {
34
+ mutation: (_CartTotalsCreateSnapshotMutation2.default.hash && _CartTotalsCreateSnapshotMutation2.default.hash !== "97e00cf77f0cc65bb808123fe5944c02" && console.error("The definition of 'CartTotalsCreateSnapshotMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartTotalsCreateSnapshotMutation2.default),
35
+ variables: {},
36
+ onCompleted: (response, errors) => {
37
+ var _response$createOrder;
38
+ setIsSharing(false);
39
+ if (errors && errors.length > 0) {
40
+ setShareError(errors[0].message);
41
+ } else if ((_response$createOrder = response.createOrderSnapshot) !== null && _response$createOrder !== void 0 && _response$createOrder.orderSnapshot) {
42
+ setSnapshot(response.createOrderSnapshot.orderSnapshot);
43
+ } else {
44
+ setShareError('Failed to create shareable link');
45
+ }
46
+ },
47
+ onError: error => {
48
+ setIsSharing(false);
49
+ setShareError(error.message);
50
+ }
51
+ });
52
+ };
53
+ (0, _react.useEffect)(() => {
54
+ var _inputRef$current;
55
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.select();
56
+ }, [snapshot]);
57
+ const timeout = (0, _react.useRef)(null);
58
+ const handleCopyToClipboard = () => {
59
+ if (snapshot !== null && snapshot !== void 0 && snapshot.shareUrl) {
60
+ navigator.clipboard.writeText(snapshot.shareUrl);
61
+ setCopied(true);
62
+ if (timeout.current) clearTimeout(timeout.current);
63
+ timeout.current = setTimeout(() => {
64
+ setCopied(false);
65
+ }, 1000);
66
+ }
67
+ };
68
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, snapshot !== null && snapshot !== void 0 && snapshot.shareUrl && snapshot !== null && snapshot !== void 0 && snapshot.quotePdfUrl ? /*#__PURE__*/_react.default.createElement("div", {
69
+ className: "cart__share"
70
+ }, /*#__PURE__*/_react.default.createElement("div", {
71
+ className: "cart__share-title"
72
+ }, "Share your cart"), /*#__PURE__*/_react.default.createElement("div", {
73
+ className: "cart__share-url-input-container"
74
+ }, /*#__PURE__*/_react.default.createElement("input", {
75
+ className: "cart__share-url-input",
76
+ ref: inputRef,
77
+ value: snapshot.shareUrl ?? '',
78
+ readOnly: true,
79
+ onClick: e => e.currentTarget.select()
80
+ }), /*#__PURE__*/_react.default.createElement("button", {
81
+ type: "button",
82
+ className: "cart__share__button cart__share__copy-button",
83
+ onClick: handleCopyToClipboard,
84
+ "data-copied": copied
85
+ }, /*#__PURE__*/_react.default.createElement("span", null, "Copy"), /*#__PURE__*/_react.default.createElement(_Icons.Check, null))), /*#__PURE__*/_react.default.createElement("a", {
86
+ href: snapshot.quotePdfUrl,
87
+ className: "cart__share__button cart__share__pdf-button",
88
+ target: "_blank",
89
+ rel: "noopener noreferrer"
90
+ }, "Download PDF quote")) : /*#__PURE__*/_react.default.createElement("button", {
91
+ type: "button",
92
+ className: "cart__share__button cart__share__share-button",
93
+ onClick: handleShareCart,
94
+ disabled: isSharing
95
+ }, isSharing ? 'Loading...' : 'Share cart'), shareError && /*#__PURE__*/_react.default.createElement("div", {
96
+ className: "cart__share-error"
97
+ }, "Cannot share your cart right now. Please try again later."));
98
+ }
99
+ function PriceBlock(_ref) {
21
100
  let {
22
101
  label,
23
102
  belowPrice,
@@ -36,8 +115,9 @@ const PriceBlock = _ref => {
36
115
  price: price,
37
116
  invert: invert
38
117
  }), belowPrice));
39
- };
118
+ }
40
119
  function CartTotals(_ref2) {
120
+ var _order$total;
41
121
  let {
42
122
  order: orderKey,
43
123
  onRemoveDiscount,
@@ -50,11 +130,11 @@ function CartTotals(_ref2) {
50
130
  "data-has-discount": Boolean(order.discount),
51
131
  "data-hide-total": hideTotal
52
132
  }, /*#__PURE__*/_react.default.createElement(PriceBlock, {
53
- label: "Subtotal:",
133
+ label: "Subtotal",
54
134
  price: order.subtotal,
55
135
  "data-line": "subtotal"
56
136
  }), order.discount && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(PriceBlock, {
57
- label: "Discount applied:",
137
+ label: "Discount applied",
58
138
  price: order.discount.amount,
59
139
  invert: true,
60
140
  belowPrice: allowDiscountRemoval && /*#__PURE__*/_react.default.createElement("button", {
@@ -70,16 +150,18 @@ function CartTotals(_ref2) {
70
150
  coupon: order.discount.coupon,
71
151
  subtract: order.discount.amount ? order.discount.amount.amount : 0
72
152
  }), ')'), /*#__PURE__*/_react.default.createElement(PriceBlock, {
73
- label: "Discounted subtotal:",
153
+ label: "Discounted subtotal",
74
154
  price: order.discountedSubtotal,
75
155
  "data-line": "discounted-subtotal"
76
156
  })), order.taxes && /*#__PURE__*/_react.default.createElement(PriceBlock, {
77
- label: order.taxName ? `${order.taxName} (${percentage(order.taxRate)}):` : `Taxes ${percentage(order.taxRate)}:`,
157
+ label: order.taxName ? `${order.taxName} (${percentage(order.taxRate)})` : `Taxes ${percentage(order.taxRate)}`,
78
158
  price: order.taxes,
79
159
  "data-line": "taxes"
80
160
  }), /*#__PURE__*/_react.default.createElement(PriceBlock, {
81
- label: `Total${order.gstIncluded ? ' including GST' : ''}:`,
161
+ label: `Total${order.gstIncluded ? ' including GST' : ''}`,
82
162
  price: order.total,
83
163
  "data-line": "total"
164
+ }), /*#__PURE__*/_react.default.createElement(ShareCart, {
165
+ key: (_order$total = order.total) === null || _order$total === void 0 ? void 0 : _order$total.amount
84
166
  }));
85
167
  }
@@ -102,7 +102,7 @@ const CouponCodeInput = _ref => {
102
102
  type: "button",
103
103
  onClick: () => setExpanded(true),
104
104
  className: "cart-additions__expand-button"
105
- }, "+ Add a coupon code"));
105
+ }, "Add a coupon code"));
106
106
  }
107
107
  return /*#__PURE__*/_react.default.createElement("div", {
108
108
  className: "cart-additions",
@@ -131,7 +131,7 @@ const CouponCodeInput = _ref => {
131
131
  type: "submit",
132
132
  className: "cart-additions__button",
133
133
  disabled: !isValid
134
- }, "Apply coupon")), isError && ((_viewer$coupon3 = viewer.coupon) === null || _viewer$coupon3 === void 0 ? void 0 : _viewer$coupon3.__typename) === 'Error' && /*#__PURE__*/_react.default.createElement("p", {
134
+ }, "Apply")), isError && ((_viewer$coupon3 = viewer.coupon) === null || _viewer$coupon3 === void 0 ? void 0 : _viewer$coupon3.__typename) === 'Error' && /*#__PURE__*/_react.default.createElement("p", {
135
135
  className: "cart-additions__error"
136
136
  }, viewer.coupon.message), ((_viewer$coupon4 = viewer.coupon) === null || _viewer$coupon4 === void 0 ? void 0 : _viewer$coupon4.__typename) === 'Coupon' && /*#__PURE__*/_react.default.createElement("p", {
137
137
  className: "cart-additions__valid-text"
@@ -89,6 +89,20 @@ function CartButtonComponent(_ref) {
89
89
  // set count only on the client, because on the server it's always gonna be zero
90
90
  setCount(cartButtonCount(orderData));
91
91
  }, [orderData, setCount]);
92
+
93
+ // Check for store-modal=open URL parameter and open cart automatically
94
+ (0, _react.useEffect)(() => {
95
+ if (typeof window !== 'undefined') {
96
+ const urlParams = new URLSearchParams(window.location.search);
97
+ if (urlParams.get('cart') === 'open') {
98
+ dispatch({
99
+ type: 'STORE_MODAL_REPLACE',
100
+ route: 'cart'
101
+ });
102
+ dispatch(openCart());
103
+ }
104
+ }
105
+ }, [dispatch]);
92
106
  if (!orderData) return null;
93
107
  if (orderData.stripeCharge && orderData.stripeCharge.paid) return null;
94
108
  const suffixNodes = formatSuffix();
@@ -94,7 +94,12 @@ function Variable(_ref) {
94
94
  value: id,
95
95
  disabled: disabled
96
96
  }, amount, " ", disabled ? '(Deprecated)' : null);
97
- }))) : null), ghost && /*#__PURE__*/_react.default.createElement("div", {
97
+ }))) : null), variable.description ? /*#__PURE__*/_react.default.createElement("div", {
98
+ className: "store-modal__order-variable-selection__description",
99
+ dangerouslySetInnerHTML: {
100
+ __html: variable.description
101
+ }
102
+ }) : null, ghost && /*#__PURE__*/_react.default.createElement("div", {
98
103
  className: "store-modal__order-variable-selection__ghost-container"
99
104
  }, "This variable has been removed from our system and is deprecated", ' ', /*#__PURE__*/_react.default.createElement("button", {
100
105
  className: "store-modal__order-variable-selection__ghost-remove",
@@ -113,7 +118,7 @@ function OrderVariableSelection(_ref3) {
113
118
  label
114
119
  }
115
120
  } = _ref3;
116
- const variables = (0, _reactRelay.useFragment)((_OrderVariableSelection_variables2.default.hash && _OrderVariableSelection_variables2.default.hash !== "cce511c94f6bca99792a0407a8d0d6a3" && console.error("The definition of 'OrderVariableSelection_variables' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _OrderVariableSelection_variables2.default), variablesKey);
121
+ const variables = (0, _reactRelay.useFragment)((_OrderVariableSelection_variables2.default.hash && _OrderVariableSelection_variables2.default.hash !== "791f9f19a96e680b9fa2b1ad81e8aa2f" && console.error("The definition of 'OrderVariableSelection_variables' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _OrderVariableSelection_variables2.default), variablesKey);
117
122
  const handleSelectionChange = (0, _react.useCallback)((variableId, optionId) => {
118
123
  var _variables$orderVaria;
119
124
  // Update the selections with the new value
@@ -65,10 +65,17 @@ const renderCustomElement = (element, key) => {
65
65
  })))), element);
66
66
  };
67
67
  const customElementTags = Object.keys(customElementMap);
68
- const allFontdueElements = element => customElementTags.flatMap(elementName => Array.from(element.querySelectorAll(elementName)));
68
+ const SINGLETONS = ['fontdue-store-modal'];
69
+ const allFontdueElements = element => customElementTags.flatMap(elementName => {
70
+ if (SINGLETONS.includes(elementName)) {
71
+ return [element.querySelector(elementName)];
72
+ } else {
73
+ return Array.from(element.querySelectorAll(elementName));
74
+ }
75
+ });
69
76
  const getInitialElements = () => {
70
77
  const map = new Map();
71
- allFontdueElements(document.body).forEach(element => map.set(element, (0, _uuid.v4)()));
78
+ allFontdueElements(document.body).filter(_utils.notEmpty).forEach(element => map.set(element, (0, _uuid.v4)()));
72
79
  return map;
73
80
  };
74
81
  const Root = props => {
@@ -88,7 +95,7 @@ const Root = props => {
88
95
  if (customElementTags.includes(node.nodeName.toLowerCase())) {
89
96
  newElements.push(node);
90
97
  }
91
- newElements = newElements.concat(allFontdueElements(node));
98
+ newElements = newElements.concat(allFontdueElements(node).filter(_utils.notEmpty));
92
99
  if (newElements.length > 0) {
93
100
  setElements(elements => {
94
101
  const newMap = new Map(elements);
@@ -103,7 +110,7 @@ const Root = props => {
103
110
  if (customElementTags.includes(node.nodeName.toLowerCase())) {
104
111
  removedElements.push(node);
105
112
  }
106
- removedElements = removedElements.concat(allFontdueElements(node));
113
+ removedElements = removedElements.concat(allFontdueElements(node).filter(_utils.notEmpty));
107
114
  if (removedElements.length > 0) {
108
115
  setElements(elements => {
109
116
  const newMap = new Map(elements);
@@ -17,7 +17,7 @@ function StoreModalOrderVariableSelection(_ref) {
17
17
  viewer: viewerKey,
18
18
  onSelectionChange
19
19
  } = _ref;
20
- const viewer = (0, _reactRelay.useFragment)((_StoreModalOrderVariableSelection_viewer2.default.hash && _StoreModalOrderVariableSelection_viewer2.default.hash !== "6c2f30b0ff62d54822aad2c955b0a579" && console.error("The definition of 'StoreModalOrderVariableSelection_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalOrderVariableSelection_viewer2.default), viewerKey);
20
+ const viewer = (0, _reactRelay.useFragment)((_StoreModalOrderVariableSelection_viewer2.default.hash && _StoreModalOrderVariableSelection_viewer2.default.hash !== "bdc0a78f68144b3270e1b8bf38f5d13f" && console.error("The definition of 'StoreModalOrderVariableSelection_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalOrderVariableSelection_viewer2.default), viewerKey);
21
21
 
22
22
  // Transform order variable selections for the OrderVariableSelection component
23
23
  const selections = (_viewer$currentOrder = viewer.currentOrder) === null || _viewer$currentOrder === void 0 ? void 0 : (_viewer$currentOrder$ = _viewer$currentOrder.orderVariableSelections) === null || _viewer$currentOrder$ === void 0 ? void 0 : _viewer$currentOrder$.map(selection => {
@@ -20,9 +20,8 @@ const createClone = styles => {
20
20
  clone.style.fontWeight = `${styles.fontWeight}`;
21
21
  clone.style.fontStyle = `${styles.fontStyle}`;
22
22
  clone.style.wordWrap = 'normal';
23
-
24
- // @ts-ignore
25
23
  clone.style.fontVariationSettings = styles.fontVariationSettings;
24
+ clone.style.fontFeatureSettings = styles.fontFeatureSettings;
26
25
  return clone;
27
26
  };
28
27
  const useTypeTesterStyler = _ref => {
@@ -45,9 +44,11 @@ const useTypeTesterStyler = _ref => {
45
44
  } = _ref;
46
45
  const ref = (0, _react.useRef)(null);
47
46
  const fontVariationSettings = variableSettings ? Object.keys(variableSettings).map(axis => `'${axis}' ${variableSettings[axis]}`).join(',') : undefined;
47
+ const fontFeatureSettings = features.map(feature => `"${feature}"`).join(', ');
48
48
  const clone = (0, _react.useRef)(createClone({
49
49
  ...fontStyles,
50
- fontVariationSettings
50
+ fontVariationSettings,
51
+ fontFeatureSettings
51
52
  }));
52
53
  const latestSizeRef = (0, _react.useRef)(size);
53
54
  let sideBuffer = autofit ? 10 : 0;
@@ -112,7 +113,7 @@ const useTypeTesterStyler = _ref => {
112
113
  lineHeight: `${lineHeight}`,
113
114
  height: shouldTruncate ? `${size * lineHeight}px` : 'auto',
114
115
  overflow: shouldTruncate ? 'hidden' : 'visible',
115
- fontFeatureSettings: features.map(feature => `"${feature}"`).join(', '),
116
+ fontFeatureSettings,
116
117
  marginRight: alignment !== 'right' ? -sideBuffer : 0,
117
118
  marginLeft: alignment === 'right' ? -sideBuffer : 0,
118
119
  letterSpacing: 0,
@@ -350,10 +350,10 @@ function StoreModalUnifiedCheckout(_ref2) {
350
350
  }, {
351
351
  show: /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h3", {
352
352
  className: "store-modal__cart__checkout-section-title"
353
- }, "Contact Information"), order.customer ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, order.customer.name, /*#__PURE__*/_react.default.createElement("br", null), order.customer.email) : 'Loading...'),
353
+ }, "Contact information"), order.customer ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, order.customer.name, /*#__PURE__*/_react.default.createElement("br", null), order.customer.email) : 'Loading...'),
354
354
  edit: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h3", {
355
355
  className: "store-modal__cart__checkout-section-title"
356
- }, "Contact Information"), /*#__PURE__*/_react.default.createElement(_CustomerFields.default, {
356
+ }, "Contact information"), /*#__PURE__*/_react.default.createElement(_CustomerFields.default, {
357
357
  value: customer,
358
358
  onChange: handleCustomerChange,
359
359
  optInLabel: (_viewer$settings = viewer.settings) === null || _viewer$settings === void 0 ? void 0 : _viewer$settings.newsletterOptInLabel
@@ -380,7 +380,7 @@ function StoreModalUnifiedCheckout(_ref2) {
380
380
  }, {
381
381
  edit: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h3", {
382
382
  className: "store-modal__cart__checkout-section-title"
383
- }, "Licensee Information (your client)"), /*#__PURE__*/_react.default.createElement("div", {
383
+ }, "Licensee information (your client)"), /*#__PURE__*/_react.default.createElement("div", {
384
384
  className: "store-modal__cart__identity-fields"
385
385
  }, /*#__PURE__*/_react.default.createElement(_AddressFields.default, {
386
386
  viewer: viewer,
@@ -391,7 +391,7 @@ function StoreModalUnifiedCheckout(_ref2) {
391
391
  }))),
392
392
  show: /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h3", {
393
393
  className: "store-modal__cart__checkout-section-title"
394
- }, "Licensee Information (your client)"), order.licenseeIdentity ? /*#__PURE__*/_react.default.createElement("div", {
394
+ }, "Licensee information (your client)"), order.licenseeIdentity ? /*#__PURE__*/_react.default.createElement("div", {
395
395
  className: "store-modal__cart__identity"
396
396
  }, /*#__PURE__*/_react.default.createElement(_StoreModalReviewIdentity.default, {
397
397
  identity: order.licenseeIdentity
@@ -408,7 +408,7 @@ function StoreModalUnifiedCheckout(_ref2) {
408
408
  }, {
409
409
  edit: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h3", {
410
410
  className: "store-modal__cart__checkout-section-title"
411
- }, "Billing Information"), /*#__PURE__*/_react.default.createElement("div", {
411
+ }, "Billing information"), /*#__PURE__*/_react.default.createElement("div", {
412
412
  className: "store-modal__cart__identity-fields"
413
413
  }, /*#__PURE__*/_react.default.createElement(_AddressFields.default, {
414
414
  viewer: viewer,
@@ -419,7 +419,7 @@ function StoreModalUnifiedCheckout(_ref2) {
419
419
  }))),
420
420
  show: /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h3", {
421
421
  className: "store-modal__cart__checkout-section-title"
422
- }, "Billing Information"), order.billingIdentity ? /*#__PURE__*/_react.default.createElement("div", {
422
+ }, "Billing information"), order.billingIdentity ? /*#__PURE__*/_react.default.createElement("div", {
423
423
  className: "store-modal__cart__identity"
424
424
  }, /*#__PURE__*/_react.default.createElement(_StoreModalReviewIdentity.default, {
425
425
  identity: order.billingIdentity
package/dist/fontdue.css CHANGED
@@ -1703,7 +1703,7 @@ body[data-fontdue-store-modal=open] {
1703
1703
  }
1704
1704
 
1705
1705
  .store-modal__license-selection__license {
1706
- margin-bottom: 20px;
1706
+ margin-bottom: 26px;
1707
1707
  }
1708
1708
 
1709
1709
  .store-modal__license-selection__license-button {
@@ -1760,6 +1760,7 @@ body[data-fontdue-store-modal=open] {
1760
1760
 
1761
1761
  .store-modal__license-selection__license-button + .store-modal__license-selection__description {
1762
1762
  margin-top: 10px;
1763
+ color: var(--secondary_text_color);
1763
1764
  }
1764
1765
 
1765
1766
  .store-modal__license-selection__license-button-label {
@@ -1883,7 +1884,7 @@ body[data-fontdue-store-modal=open] {
1883
1884
  }
1884
1885
 
1885
1886
  .store-modal__order-variable-selection__item:not(:last-child) {
1886
- margin-bottom: 20px;
1887
+ margin-bottom: 26px;
1887
1888
  }
1888
1889
 
1889
1890
  .store-modal__order-variable-selection__button {
@@ -2012,6 +2013,11 @@ body[data-fontdue-store-modal=open] {
2012
2013
  border-bottom-color: var(--link_hover_color);
2013
2014
  }
2014
2015
 
2016
+ .store-modal__order-variable-selection__description {
2017
+ margin-top: 10px;
2018
+ color: var(--secondary_text_color);
2019
+ }
2020
+
2015
2021
  .store-modal__page__container {
2016
2022
  flex: 1;
2017
2023
  display: flex;
@@ -2145,7 +2151,7 @@ body[data-fontdue-store-modal=open] {
2145
2151
  text-transform: inherit;
2146
2152
  background: var(--button_background_color);
2147
2153
  border: 1px solid var(--button_border_color);
2148
- color: 1px solid var(--button_text_color);
2154
+ color: var(--button_text_color);
2149
2155
  padding: 10px 20px;
2150
2156
  }
2151
2157
  .cart-additions__expand-button:active, .cart-additions__expand-button:focus {
@@ -2217,6 +2223,7 @@ body[data-fontdue-store-modal=open] {
2217
2223
  margin-right: -1px;
2218
2224
  padding-right: 35px;
2219
2225
  font-family: inherit;
2226
+ min-width: 0;
2220
2227
  }
2221
2228
  .cart-additions[data-status=error] .cart-additions__field {
2222
2229
  color: var(--error_color);
@@ -2495,7 +2502,9 @@ body[data-fontdue-store-modal=open] {
2495
2502
  .cart__price-block {
2496
2503
  display: grid;
2497
2504
  grid-template-columns: 1fr 1fr;
2505
+ grid-column-gap: 20px;
2498
2506
  margin: 20px 0;
2507
+ align-items: baseline;
2499
2508
  }
2500
2509
  .cart__price-block__price {
2501
2510
  text-align: right;
@@ -2540,6 +2549,120 @@ body[data-fontdue-store-modal=open] {
2540
2549
  font-size: 22px;
2541
2550
  }
2542
2551
 
2552
+ /* Share URL section */
2553
+ .cart__share {
2554
+ margin-top: 20px;
2555
+ margin-bottom: 20px;
2556
+ padding-top: 20px;
2557
+ width: 100%;
2558
+ border-top: 1px solid var(--horizontal_rule_color);
2559
+ }
2560
+
2561
+ .cart__share-title {
2562
+ margin-bottom: 20px;
2563
+ }
2564
+
2565
+ .cart__share-url-input-container {
2566
+ display: flex;
2567
+ margin-bottom: 20px;
2568
+ }
2569
+
2570
+ .cart__share-url-input {
2571
+ background: none;
2572
+ color: inherit;
2573
+ font: inherit;
2574
+ text-decoration: inherit;
2575
+ text-align: inherit;
2576
+ border: 0;
2577
+ border-radius: 0;
2578
+ padding: 0;
2579
+ margin: 0;
2580
+ appearance: none;
2581
+ text-transform: inherit;
2582
+ min-width: 0;
2583
+ flex: 1 1 0;
2584
+ color: currentcolor;
2585
+ padding: 10px 15px;
2586
+ background: var(--secondary_background_color);
2587
+ border: 1px solid var(--secondary_background_color);
2588
+ border-right: none;
2589
+ }
2590
+ .cart__share-url-input:active, .cart__share-url-input:focus {
2591
+ outline: none;
2592
+ }
2593
+ .cart__share-url-input:focus {
2594
+ border-color: var(--primary_text_color);
2595
+ }
2596
+
2597
+ .cart__share-url-text {
2598
+ font-family: monospace;
2599
+ word-break: break-all;
2600
+ margin-bottom: 15px;
2601
+ padding: 8px;
2602
+ border-radius: 4px;
2603
+ }
2604
+
2605
+ .cart__share__button {
2606
+ background: none;
2607
+ color: inherit;
2608
+ font: inherit;
2609
+ text-decoration: inherit;
2610
+ text-align: inherit;
2611
+ border: 0;
2612
+ border-radius: 0;
2613
+ padding: 0;
2614
+ margin: 0;
2615
+ appearance: none;
2616
+ text-transform: inherit;
2617
+ text-align: center;
2618
+ background: var(--button_background_color);
2619
+ border: 1px solid var(--button_border_color);
2620
+ color: 1px solid var(--button_text_color);
2621
+ padding: 10px 20px;
2622
+ }
2623
+ .cart__share__button:active, .cart__share__button:focus {
2624
+ outline: none;
2625
+ }
2626
+ .cart__share__button:not(:disabled) {
2627
+ cursor: pointer;
2628
+ }
2629
+ .cart__share__button:hover {
2630
+ background: var(--button_hover_background_color);
2631
+ border-color: var(--button_hover_border_color);
2632
+ color: var(--button_hover_text_color);
2633
+ }
2634
+
2635
+ .cart__share__pdf-button,
2636
+ .cart__share__share-button {
2637
+ display: block;
2638
+ width: 100%;
2639
+ margin-bottom: 60px;
2640
+ }
2641
+
2642
+ .cart__share__copy-button {
2643
+ position: relative;
2644
+ white-space: nowrap;
2645
+ }
2646
+ .cart__share__copy-button .icon {
2647
+ visibility: hidden;
2648
+ position: absolute;
2649
+ top: 50%;
2650
+ left: 50%;
2651
+ transform: translate(-50%, -50%);
2652
+ font-size: 1em;
2653
+ }
2654
+ .cart__share__copy-button[data-copied=true] span {
2655
+ visibility: hidden;
2656
+ }
2657
+ .cart__share__copy-button[data-copied=true] .icon {
2658
+ visibility: visible;
2659
+ }
2660
+
2661
+ .cart__share-error {
2662
+ color: var(--error_color);
2663
+ margin-top: 10px;
2664
+ }
2665
+
2543
2666
  .checkout-modal__form {
2544
2667
  display: contents;
2545
2668
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fontdue-js",
3
- "version": "2.11.0",
3
+ "version": "2.12.1",
4
4
  "scripts": {
5
5
  "build": "npm run relay && run-p build-js build-css build-ts",
6
6
  "build-js": "babel src --out-dir dist --extensions .ts,.tsx,.js,.jsx",